Merge branch 'master' of https://github.com/danvk/dygraphs
[dygraphs.git] / tests / visibility.html
1 <html>
2 <head>
3 <title>visibility</title>
4 <!--[if IE]>
5 <script type="text/javascript" src="../excanvas.js"></script>
6 <![endif]-->
7 <script type="text/javascript" src="../strftime/strftime-min.js"></script>
8 <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script>
9 <script type="text/javascript" src="../dygraph-canvas.js"></script>
10 <script type="text/javascript" src="../dygraph.js"></script>
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>
23 </p>
24
25 <p>g.visibility() = <span id="visibility"></span></p>
26
27
28 <script type="text/javascript">
29 g = new Dygraph(
30 document.getElementById("div_g"),
31 NoisyData, {
32 rollPeriod: 7,
33 errorBars: true,
34 visibility: [false, true]
35 }
36 );
37 setStatus();
38
39 function setStatus() {
40 document.getElementById("visibility").innerHTML =
41 g.visibility().toString();
42 }
43
44 function change(el) {
45 g.setVisibility(parseInt(el.id), el.checked);
46 setStatus();
47 }
48 </script>
49
50 </body>
51 </html>