| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Temperatures with Range Selector</title> |
| 5 | <!-- |
| 6 | For production (minified) code, use: |
| 7 | <script type="text/javascript" src="dygraph-combined.js"></script> |
| 8 | --> |
| 9 | <script type="text/javascript" src="../dygraph-dev.js"></script> |
| 10 | |
| 11 | <script type="text/javascript" src="data.js"></script> |
| 12 | <style type="text/css"> |
| 13 | #bordered { |
| 14 | border: 1px solid red; |
| 15 | } |
| 16 | </style> |
| 17 | </head> |
| 18 | <body> |
| 19 | <p>Demo of a graph with the range selector.</p> |
| 20 | <p> |
| 21 | No roll period. |
| 22 | </p> |
| 23 | <div id="noroll" style="width:800px; height:320px;"></div> |
| 24 | <p> |
| 25 | Roll period of 14 timesteps, custom range selector height and plot color. |
| 26 | </p> |
| 27 | <div id="roll14" style="width:800px; height:320px;"></div> |
| 28 | <p> |
| 29 | Use the average of a specific subset of series to draw the mini plot (only the first series is used in this test). |
| 30 | The default behaviour is to compute the average of <em>all</em> series. |
| 31 | </p> |
| 32 | <div id="selectcombined" style="width:800px; height:320px;"></div> |
| 33 | <p> |
| 34 | Demo of range selecor without the chart. (interesting if multiple charts should be synced with one range selector). |
| 35 | </p> |
| 36 | <div id="nochart" style="width:800px; height:30px;"></div> |
| 37 | <p>Demo of range selector with stepPlot</p> |
| 38 | <div id="stepplot" style="width:800px; height:320px;"></div> |
| 39 | |
| 40 | <script type="text/javascript"> |
| 41 | g1 = new Dygraph( |
| 42 | document.getElementById("noroll"), |
| 43 | data_temp, |
| 44 | { |
| 45 | customBars: true, |
| 46 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 47 | ylabel: 'Temperature (F)', |
| 48 | legend: 'always', |
| 49 | labelsDivStyles: { 'textAlign': 'right' }, |
| 50 | showRangeSelector: true |
| 51 | } |
| 52 | ); |
| 53 | g2 = new Dygraph( |
| 54 | document.getElementById("roll14"), |
| 55 | data_temp, |
| 56 | { |
| 57 | rollPeriod: 14, |
| 58 | showRoller: true, |
| 59 | customBars: true, |
| 60 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 61 | ylabel: 'Temperature (F)', |
| 62 | legend: 'always', |
| 63 | labelsDivStyles: { 'textAlign': 'right' }, |
| 64 | xAxisHeight: 14, |
| 65 | showRangeSelector: true, |
| 66 | rangeSelectorHeight: 30, |
| 67 | rangeSelectorPlotStrokeColor: 'yellow', |
| 68 | rangeSelectorPlotFillColor: 'lightyellow' |
| 69 | } |
| 70 | ); |
| 71 | g3 = new Dygraph( |
| 72 | document.getElementById("selectcombined"), |
| 73 | [ |
| 74 | [0, 1, 4, 10], |
| 75 | [10, 2, 8, 19], |
| 76 | [25, 15, 4, 2], |
| 77 | [35, 0, 3, 2] |
| 78 | ], |
| 79 | { |
| 80 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 81 | ylabel: 'Temperature (F)', |
| 82 | showRangeSelector: true, |
| 83 | labels: ['X', 'Y1', 'Y2', 'Y3'], |
| 84 | series: { |
| 85 | 'Y1': { showInRangeSelector: true } |
| 86 | } |
| 87 | } |
| 88 | ); |
| 89 | g4 = new Dygraph( |
| 90 | document.getElementById("nochart"), |
| 91 | [[0,1],[10,1]], |
| 92 | { |
| 93 | xAxisHeight: 30, |
| 94 | axes : { |
| 95 | x : { |
| 96 | drawAxis : false |
| 97 | } |
| 98 | }, |
| 99 | showRangeSelector: true, |
| 100 | rangeSelectorHeight: 30 |
| 101 | } |
| 102 | ); |
| 103 | g5 = new Dygraph(document.getElementById("stepplot"), |
| 104 | "Date,Idle,Used\n" + |
| 105 | "2008-05-07,70,30\n" + |
| 106 | "2008-05-08,42,88\n" + |
| 107 | "2008-05-09,88,42\n" + |
| 108 | "2008-05-10,33,37\n" + |
| 109 | "2008-05-11,30,35\n", |
| 110 | { |
| 111 | stepPlot: true, |
| 112 | fillGraph: true, |
| 113 | stackedGraph: true, |
| 114 | includeZero: true, |
| 115 | showRangeSelector: true |
| 116 | }); |
| 117 | </script> |
| 118 | </body> |
| 119 | </html> |