Merge pull request #622 from JoesephPaulSmith/master
[dygraphs.git] / tests / visibility.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>visibility</title>
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
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)">
22 <label for="1"> B</label><br/>
23 <input type=checkbox id="2" checked onClick="change(this)">
24 <label for="2"> C</label>
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"),
33 NoisyDataABC, {
34 rollPeriod: 7,
35 errorBars: true,
36 visibility: [false, true, true]
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>