| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9"> |
| 5 | <title>visibility</title> |
| 6 | <!--[if IE]> |
| 7 | <script type="text/javascript" src="../excanvas.js"></script> |
| 8 | <![endif]--> |
| 9 | <script type="text/javascript" src="../strftime/strftime-min.js"></script> |
| 10 | <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script> |
| 11 | <script type="text/javascript" src="../dygraph-canvas.js"></script> |
| 12 | <script type="text/javascript" src="../dygraph.js"></script> |
| 13 | <script type="text/javascript" src="data.js"></script> |
| 14 | </head> |
| 15 | <body> |
| 16 | <h3>Click the check boxes to toggle series visibility</h3> |
| 17 | <div id="div_g" style="width:600px; height:300px;"></div> |
| 18 | |
| 19 | <p><b>Show Series:</b></p> |
| 20 | <p> |
| 21 | <input type=checkbox id="0" onClick="change(this)"> |
| 22 | <label for="0"> A</label><br/> |
| 23 | <input type=checkbox id="1" checked onClick="change(this)"> |
| 24 | <label for="1"> B</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 | NoisyData, { |
| 34 | rollPeriod: 7, |
| 35 | errorBars: true, |
| 36 | visibility: [false, 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> |