visibility test
authorDan Vanderkam <danvdk@gmail.com>
Wed, 23 Dec 2009 22:51:19 +0000 (17:51 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Wed, 23 Dec 2009 22:51:19 +0000 (17:51 -0500)
tests/visibility.html [new file with mode: 0644]

diff --git a/tests/visibility.html b/tests/visibility.html
new file mode 100644 (file)
index 0000000..09c25e6
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+  <head>
+    <title>noise</title>
+    <!--[if IE]>
+    <script type="text/javascript" src="excanvas.js"></script>
+    <![endif]-->
+    <script type="text/javascript" src="../dygraph-combined.js"></script>
+    <script type="text/javascript" src="../dygraph-canvas.js"></script>
+    <script type="text/javascript" src="../dygraph.js"></script>
+    <script type="text/javascript" src="data.js"></script>
+  </head>
+  <body>
+    <h3>Click the check boxes to toggle series visibility</h3>
+    <div id="div_g" style="width:600px; height:300px;"></div>
+
+    <p><b>Show Series:</b></p>
+    <p>
+      <input type=checkbox id="0" onClick="change(this)">
+      <label for="0"> A</label><br/>
+      <input type=checkbox id="1" checked onClick="change(this)">
+      <label for="1"> B</label>
+    </p>
+
+    <p>g.visibility() = <span id="visibility"></span></p>
+
+
+    <script type="text/javascript">
+      g = new Dygraph(
+            document.getElementById("div_g"),
+            NoisyData, {
+              rollPeriod: 7,
+              errorBars: true,
+              visibility: [false, true]
+            }
+          );
+      setStatus();
+
+      function setStatus() {
+        document.getElementById("visibility").innerHTML =
+          g.visibility().toString();
+      }
+
+      function change(el) {
+        g.setVisibility(parseInt(el.id), el.checked);
+        setStatus();
+      }
+    </script>
+
+  </body>
+</html>