Merge pull request #596 from danvk/bower-ignore
[dygraphs.git] / tests / stacked.html
CommitLineData
54425b14 1<!DOCTYPE html>
12e4c741
NK
2<html>
3 <head>
4 <title>stacked</title>
7e5ddc94
DV
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
12e4c741
NK
11 </head>
12 <body>
d160cc3b 13 <p>Simple graph:</p>
354e15ab 14 <div id="simple_div"></div>
d160cc3b 15 <p>Stacked graph:</p>
354e15ab
DE
16 <div id="stacked_div"></div>
17 <p>Simple graph with missing data:</p>
18 <div id="simple_missing_div"></div>
19 <p>Stacked graph with missing data:</p>
20 <div id="stacked_missing_div"></div>
21 <p>Stacked graph with many series:</p>
22 <div id="stacked_many_div"></div>
38f33a44 23 <p>Change selection/highlighting on all graphs:</p>
24 <div id="graph_selection_div">
25 <select onchange="javascript:setSelection(this.options[this.selectedIndex].value);">
26 <option value="" selected></option>
27 <option value="0">0</option>
28 <option value="10">10</option>
29 <option value="20">20</option>
30 <option value="30">30</option>
31 <option value="40">40</option>
32 <option value="50">50</option>
33 <option value="60">60</option>
34 <option value="70">70</option>
35 <option value="80">80</option>
36 <option value="90">90</option>
37 <option value="99">99</option>
38 </select>
39 </div>
12e4c741
NK
40
41 <script type="text/javascript">
d1278ac9
DV
42 data = "X,x,100-x\n";
43 for (var i = 0; i < 100; i++) {
44 data += i + "," + i + "," + (100 - i) + "\n";
45 }
38f33a44 46
47 var graphs = [];
d1278ac9 48
38f33a44 49 graphs.push(
50 new Dygraph(
51 document.getElementById("simple_div"),
52 data));
53
54 graphs.push(
55 new Dygraph(
56 document.getElementById("stacked_div"),
57 data,
58 { stackedGraph: true }));
354e15ab
DE
59
60 missing_data = "X,x,100-x\n";
61 for (var i = 0; i < 100; i++) {
62 if (i >= 20 && i < 40) {
63 missing_data += i + ",," + (100 - i) + "\n";
64 } else if (i >= 60 && i < 80) {
65 missing_data += i + "," + i + ",\n";
66 } else {
67 missing_data += i + "," + i + "," + (100 - i) + "\n";
68 }
69 }
70
38f33a44 71 graphs.push(
72 new Dygraph(
73 document.getElementById("simple_missing_div"),
74 missing_data));
75
76 graphs.push(
77 new Dygraph(
78 document.getElementById("stacked_missing_div"),
79 missing_data,
80 { stackedGraph: true }));
354e15ab
DE
81
82 many_data = "X,a,b,c,d,e,100-a,100-b,100-c,100-d,100-e\n";
83 for (var i = 0; i < 100; i++) {
84 many_data += i + "," + i + "," + i + "," + i + "," + i + "," + i;
85 j = 100 - i;
86 many_data += "," + j + "," + j + "," + j + "," + j + "," + j;
87 many_data += "\n";
88 }
89
38f33a44 90 graphs.push(
91 new Dygraph(
92 document.getElementById("stacked_many_div"),
93 many_data,
94 { stackedGraph: true }));
95
96 function setSelection(row) {
97 for (var i = 0; i < graphs.length; i++) {
98 graphs[i].setSelection(row ? row : false);
99 }
100 }
12e4c741
NK
101 </script>
102 </body>
103</html>