Commit | Line | Data |
---|---|---|
e88a95b4 DV |
1 | /*global Gallery,Dygraph,data */ |
2 | /*global data_temp */ | |
72c8bf99 RK |
3 | Gallery.register( |
4 | 'range-selector', | |
5 | { | |
6 | name: 'Range Selector', | |
7 | title: 'Demo of the Range Selector', | |
8 | setup: function(parent) { | |
605b6119 | 9 | parent.innerHTML = [ |
93a5bb4c DV |
10 | "<style>", |
11 | " #darkbg .dygraph-axis-label { color: white; }", | |
12 | " .dygraph-legend { text-align: right; }", | |
13 | " #darkbg .dygraph-legend { background-color: #101015; }", | |
14 | "</style>", | |
605b6119 | 15 | "<p>No roll period.</p>", |
10eef8e9 | 16 | "<div id='noroll' style='width:600px; height:300px;'></div>", |
605b6119 RK |
17 | "", |
18 | "<p>Roll period of 14 timesteps, custom range selector height and plot color.</p>", | |
79cb28dd | 19 | "<div id='roll14' style='width:600px; height:300px;'></div>", |
20 | "", | |
21 | "<div style='background-color: #101015; color: white'>", | |
22 | "<p>Dark background, custom range selector gradient color.</p>", | |
23 | "<div id='darkbg' style='width:600px; height:300px;'></div>", | |
24 | "</div>"].join("\n"); | |
72c8bf99 RK |
25 | }, |
26 | run: function() { | |
e88a95b4 | 27 | new Dygraph( |
72c8bf99 RK |
28 | document.getElementById("noroll"), |
29 | data_temp, | |
30 | { | |
31 | customBars: true, | |
32 | title: 'Daily Temperatures in New York vs. San Francisco', | |
33 | ylabel: 'Temperature (F)', | |
34 | legend: 'always', | |
72c8bf99 RK |
35 | showRangeSelector: true |
36 | } | |
37 | ); | |
e88a95b4 | 38 | new Dygraph( |
72c8bf99 RK |
39 | document.getElementById("roll14"), |
40 | data_temp, | |
41 | { | |
42 | rollPeriod: 14, | |
43 | showRoller: true, | |
44 | customBars: true, | |
45 | title: 'Daily Temperatures in New York vs. San Francisco', | |
46 | ylabel: 'Temperature (F)', | |
47 | legend: 'always', | |
72c8bf99 RK |
48 | showRangeSelector: true, |
49 | rangeSelectorHeight: 30, | |
50 | rangeSelectorPlotStrokeColor: 'yellow', | |
51 | rangeSelectorPlotFillColor: 'lightyellow' | |
79cb28dd | 52 | } |
53 | ); | |
54 | new Dygraph( | |
55 | document.getElementById("darkbg"), | |
56 | data_temp, | |
57 | { | |
58 | rollPeriod: 14, | |
59 | showRoller: true, | |
60 | customBars: true, | |
61 | title: 'Nightly Temperatures in New York vs. San Francisco', | |
62 | ylabel: 'Temperature (F)', | |
63 | legend: 'always', | |
79cb28dd | 64 | showRangeSelector: true, |
65 | rangeSelectorPlotFillColor: 'MediumSlateBlue', | |
66 | rangeSelectorPlotFillGradientColor: 'rgba(123, 104, 238, 0)', | |
79cb28dd | 67 | colorValue: 0.9, |
68 | fillAlpha: 0.4 | |
69 | } | |
70 | ); | |
72c8bf99 RK |
71 | } |
72 | }); |