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