Commit | Line | Data |
---|---|---|
54425b14 | 1 | <!DOCTYPE html> |
bf0e5ca5 DV |
2 | <html> |
3 | <head> | |
937029df | 4 | <title>visibility</title> |
7e5ddc94 DV |
5 | <!-- |
6 | For production (minified) code, use: | |
7 | <script type="text/javascript" src="dygraph-combined.js"></script> | |
8 | --> | |
fbd6834a | 9 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
7e5ddc94 | 10 | |
bf0e5ca5 DV |
11 | <script type="text/javascript" src="data.js"></script> |
12 | </head> | |
13 | <body> | |
14 | <h3>Click the check boxes to toggle series visibility</h3> | |
15 | <div id="div_g" style="width:600px; height:300px;"></div> | |
16 | ||
17 | <p><b>Show Series:</b></p> | |
18 | <p> | |
19 | <input type=checkbox id="0" onClick="change(this)"> | |
20 | <label for="0"> A</label><br/> | |
21 | <input type=checkbox id="1" checked onClick="change(this)"> | |
ddb40267 RK |
22 | <label for="1"> B</label><br/> |
23 | <input type=checkbox id="2" checked onClick="change(this)"> | |
24 | <label for="2"> C</label> | |
bf0e5ca5 DV |
25 | </p> |
26 | ||
27 | <p>g.visibility() = <span id="visibility"></span></p> | |
28 | ||
29 | ||
30 | <script type="text/javascript"> | |
31 | g = new Dygraph( | |
32 | document.getElementById("div_g"), | |
ddb40267 | 33 | NoisyDataABC, { |
bf0e5ca5 DV |
34 | rollPeriod: 7, |
35 | errorBars: true, | |
ddb40267 | 36 | visibility: [false, true, true] |
bf0e5ca5 DV |
37 | } |
38 | ); | |
39 | setStatus(); | |
40 | ||
41 | function setStatus() { | |
42 | document.getElementById("visibility").innerHTML = | |
43 | g.visibility().toString(); | |
44 | } | |
45 | ||
46 | function change(el) { | |
47 | g.setVisibility(parseInt(el.id), el.checked); | |
48 | setStatus(); | |
49 | } | |
50 | </script> | |
51 | ||
52 | </body> | |
53 | </html> |