some tweaks to knikhil's change
[dygraphs.git] / tests / visibility.html
CommitLineData
bf0e5ca5
DV
1<html>
2 <head>
3 <title>noise</title>
4 <!--[if IE]>
5 <script type="text/javascript" src="excanvas.js"></script>
6 <![endif]-->
7 <script type="text/javascript" src="../dygraph-combined.js"></script>
8 <script type="text/javascript" src="../dygraph-canvas.js"></script>
9 <script type="text/javascript" src="../dygraph.js"></script>
10 <script type="text/javascript" src="data.js"></script>
11 </head>
12 <body>
13 <h3>Click the check boxes to toggle series visibility</h3>
14 <div id="div_g" style="width:600px; height:300px;"></div>
15
16 <p><b>Show Series:</b></p>
17 <p>
18 <input type=checkbox id="0" onClick="change(this)">
19 <label for="0"> A</label><br/>
20 <input type=checkbox id="1" checked onClick="change(this)">
21 <label for="1"> B</label>
22 </p>
23
24 <p>g.visibility() = <span id="visibility"></span></p>
25
26
27 <script type="text/javascript">
28 g = new Dygraph(
29 document.getElementById("div_g"),
30 NoisyData, {
31 rollPeriod: 7,
32 errorBars: true,
33 visibility: [false, true]
34 }
35 );
36 setStatus();
37
38 function setStatus() {
39 document.getElementById("visibility").innerHTML =
40 g.visibility().toString();
41 }
42
43 function change(el) {
44 g.setVisibility(parseInt(el.id), el.checked);
45 setStatus();
46 }
47 </script>
48
49 </body>
50</html>