| 1 | /*global Gallery,Dygraph,data */ |
| 2 | /*global data_temp */ |
| 3 | Gallery.register( |
| 4 | // Get a better name. |
| 5 | 'temperature-sf-ny', |
| 6 | { |
| 7 | name: 'Roll Periods and Error Bars', |
| 8 | title: 'Demo of a graph with many data points and custom error bars.', |
| 9 | setup: function(parent) { |
| 10 | parent.innerHTML = [ |
| 11 | "<p>Roll period of 14 timesteps.</p>", |
| 12 | "<div id='roll14' style='width:600px; height:300px;'></div>", |
| 13 | "<p>No roll period.</p>", |
| 14 | "<div id='noroll' style='width:600px; height:300px;'></div>"] |
| 15 | .join("\n"); |
| 16 | }, |
| 17 | run: function() { |
| 18 | new Dygraph( |
| 19 | document.getElementById("noroll"), |
| 20 | data_temp, |
| 21 | { |
| 22 | customBars: true, |
| 23 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 24 | ylabel: 'Temperature (F)', |
| 25 | legend: 'always', |
| 26 | labelsDivStyles: { 'textAlign': 'right' } |
| 27 | } |
| 28 | ); |
| 29 | new Dygraph( |
| 30 | document.getElementById("roll14"), |
| 31 | data_temp, |
| 32 | { |
| 33 | rollPeriod: 14, |
| 34 | showRoller: true, |
| 35 | customBars: true, |
| 36 | title: 'Daily Temperatures in New York vs. San Francisco', |
| 37 | ylabel: 'Temperature (F)', |
| 38 | legend: 'always', |
| 39 | labelsDivStyles: { 'textAlign': 'right' } |
| 40 | } |
| 41 | ); |
| 42 | } |
| 43 | }); |