| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
| 5 | <title>Temperatures with Range Selector</title> |
| 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
| 7 | |
| 8 | <script type="text/javascript" src="data.js"></script> |
| 9 | <style type="text/css"> |
| 10 | #bordered { |
| 11 | border: 1px solid red; |
| 12 | } |
| 13 | #dark-background { |
| 14 | background-color: #101015; |
| 15 | color: white; |
| 16 | } |
| 17 | #darkbg1 .dygraph-axis-label, #darkbg2 .dygraph-axis-label { |
| 18 | color: white; |
| 19 | } |
| 20 | #noroll .dygraph-legend, |
| 21 | #roll14 .dygraph-legend, |
| 22 | #darkbg1 .dygraph-legend, |
| 23 | #darkbg2 .dygraph-legend { |
| 24 | text-align: right; |
| 25 | } |
| 26 | #darkbg1 .dygraph-legend { |
| 27 | background-color: #101015; |
| 28 | } |
| 29 | #darkbg2 .dygraph-legend { |
| 30 | background-color: #101015; |
| 31 | } |
| 32 | </style> |
| 33 | </head> |
| 34 | <body> |
| 35 | <p>Demo of a graph with the range selector.</p> |
| 36 | <p> |
| 37 | No roll period. |
| 38 | </p> |
| 39 | <div id="noroll" style="width:800px; height:320px;"></div> |
| 40 | |
| 41 | <h2 id="options">Range selector options</h2> |
| 42 | <p>Here's a view of how the various <a href="../options.html#Range%20Selector">range selector options</a> affect the display:</p> |
| 43 | <img width="954" height="354" src="range-selector-anatomy.png"> |
| 44 | |
| 45 | <p> |
| 46 | Roll period of 14 timesteps, various custom range selector options. |
| 47 | </p> |
| 48 | <div id="roll14" style="width:800px; height:320px;"></div> |
| 49 | <p> |
| 50 | Use the average of a specific subset of series to draw the mini plot (only the first series is used in this test). |
| 51 | The default behaviour is to compute the average of <em>all</em> series. |
| 52 | </p> |
| 53 | <div id="selectcombined" style="width:800px; height:320px;"></div> |
| 54 | |
| 55 | <p> |
| 56 | Demo of range selecor without the chart. (interesting if multiple charts should be synced with one range selector). |
| 57 | </p> |
| 58 | <div id="nochart" style="width:800px; height:30px;"></div> |
| 59 | <div id="dark-background"> |
| 60 | <p>Demo of range selector on dark background, with (left) and without (right) custom range selector gradient color.</p> |
| 61 | <div id="darkbg1" style="width:400px; height:300px;display:inline-block;"></div> |
| 62 | <div id="darkbg2" style="width:400px; height:300px;display:inline-block;"></div> |
| 63 | </div> |
| 64 | <p>Demo of range selector with stepPlot</p> |
| 65 | <div id="stepplot" style="width:800px; height:320px;"></div> |
| 66 | |
| 67 | <script type="text/javascript"> |
| 68 | g1 = new Dygraph( |
| 69 | document.getElementById("noroll"), |
| 70 | data_temp, |
| 71 | { |
| 72 | customBars: true, |
| 73 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 74 | ylabel: 'Temperature (F)', |
| 75 | legend: 'always', |
| 76 | showRangeSelector: true |
| 77 | } |
| 78 | ); |
| 79 | g2 = new Dygraph( |
| 80 | document.getElementById("roll14"), |
| 81 | data_temp, |
| 82 | { |
| 83 | rollPeriod: 14, |
| 84 | showRoller: true, |
| 85 | customBars: true, |
| 86 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 87 | ylabel: 'Temperature (F)', |
| 88 | legend: 'always', |
| 89 | xAxisHeight: 14, |
| 90 | showRangeSelector: true, |
| 91 | rangeSelectorHeight: 80, |
| 92 | rangeSelectorPlotStrokeColor: 'purple', |
| 93 | rangeSelectorPlotFillColor: 'black', |
| 94 | rangeSelectorBackgroundStrokeColor: 'orange', |
| 95 | rangeSelectorBackgroundLineWidth: 4, |
| 96 | rangeSelectorPlotLineWidth: 5, |
| 97 | rangeSelectorForegroundStrokeColor: 'brown', |
| 98 | rangeSelectorForegroundLineWidth: 8, |
| 99 | rangeSelectorAlpha: 0.5, |
| 100 | rangeSelectorPlotFillGradientColor: 'red' |
| 101 | } |
| 102 | ); |
| 103 | g3 = new Dygraph( |
| 104 | document.getElementById("selectcombined"), |
| 105 | [ |
| 106 | [0, 1, 4, 10], |
| 107 | [10, 2, 8, 19], |
| 108 | [25, 15, 4, 2], |
| 109 | [35, 0, 3, 2] |
| 110 | ], |
| 111 | { |
| 112 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 113 | ylabel: 'Temperature (F)', |
| 114 | showRangeSelector: true, |
| 115 | labels: ['X', 'Y1', 'Y2', 'Y3'], |
| 116 | series: { |
| 117 | 'Y1': { showInRangeSelector: true } |
| 118 | } |
| 119 | } |
| 120 | ); |
| 121 | g4 = new Dygraph( |
| 122 | document.getElementById("nochart"), |
| 123 | [[0,1],[10,1]], |
| 124 | { |
| 125 | xAxisHeight: 30, |
| 126 | axes : { |
| 127 | x : { |
| 128 | drawAxis : false |
| 129 | } |
| 130 | }, |
| 131 | labels: ['X', 'Y'], |
| 132 | showRangeSelector: true, |
| 133 | rangeSelectorHeight: 30 |
| 134 | } |
| 135 | ); |
| 136 | g5 = new Dygraph( |
| 137 | document.getElementById("darkbg1"), |
| 138 | data_temp, |
| 139 | { |
| 140 | rollPeriod: 14, |
| 141 | showRoller: true, |
| 142 | customBars: true, |
| 143 | title: 'Nightly Temperatures in NY vs. SF', |
| 144 | ylabel: 'Temperature (F)', |
| 145 | legend: 'always', |
| 146 | showRangeSelector: true, |
| 147 | rangeSelectorPlotFillColor: 'MediumSlateBlue', |
| 148 | rangeSelectorPlotFillGradientColor: 'rgba(123, 104, 238, 0)', |
| 149 | colorValue: 0.9, |
| 150 | fillAlpha: 0.4 |
| 151 | } |
| 152 | ); |
| 153 | g6 = new Dygraph( |
| 154 | document.getElementById("darkbg2"), |
| 155 | data_temp, |
| 156 | { |
| 157 | rollPeriod: 14, |
| 158 | showRoller: true, |
| 159 | customBars: true, |
| 160 | title: 'Nightly Temperatures in NY vs. SF', |
| 161 | ylabel: 'Temperature (F)', |
| 162 | legend: 'always', |
| 163 | showRangeSelector: true, |
| 164 | rangeSelectorPlotFillColor: 'MediumSlateBlue', |
| 165 | colorValue: 0.9, |
| 166 | fillAlpha: 0.4 |
| 167 | } |
| 168 | ); |
| 169 | g7 = new Dygraph(document.getElementById("stepplot"), |
| 170 | "Date,Idle,Used\n" + |
| 171 | "2008-05-07,70,30\n" + |
| 172 | "2008-05-08,42,88\n" + |
| 173 | "2008-05-09,88,42\n" + |
| 174 | "2008-05-10,33,37\n" + |
| 175 | "2008-05-11,30,35\n", |
| 176 | { |
| 177 | stepPlot: true, |
| 178 | fillGraph: true, |
| 179 | stackedGraph: true, |
| 180 | includeZero: true, |
| 181 | showRangeSelector: true |
| 182 | }); |
| 183 | </script> |
| 184 | </body> |
| 185 | </html> |