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