Fix bug 428, add test which catches exception. What an annoying little bug.
[dygraphs.git] / tests / two-axes.html
index bc03abc..3f40b07 100644 (file)
@@ -1,17 +1,25 @@
+<!DOCTYPE html>
 <html>
   <head>
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
     <title>Multiple y-axes</title>
     <!--[if IE]>
-    <script type="text/javascript" src="excanvas.js"></script>
+    <script type="text/javascript" src="../excanvas.js"></script>
     <![endif]-->
-    <script type="text/javascript" src="../strftime/strftime-min.js"></script>
-    <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script>
-    <script type="text/javascript" src="../dygraph-canvas.js"></script>
-    <script type="text/javascript" src="../dygraph.js"></script>
+    <!--
+    For production (minified) code, use:
+    <script type="text/javascript" src="dygraph-combined.js"></script>
+    -->
+    <script type="text/javascript" src="../dygraph-dev.js"></script>
+
   </head>
   <body>
     <h2>Multiple y-axes</h2>
-    <div id="demodiv"></div>
+    <p>The same data with both one and two y-axes. Two y-axes:</p>
+    <div id="demodiv" style="width: 640; height: 350; border: 1px solid black"></div>
+    <p>A single y-axis:</p>
+    <div id="demodiv_one" style="width: 640; height: 350; border: 1px solid black"></div>
+
     <script type="text/javascript">
       var data = [];
       for (var i = 1; i <= 100; i++) {
                    1e6 * (1 + i * (100 - i) / (50 * 50)),
                    1e6 * (2 - i * (100 - i) / (50 * 50))]);
       }
+
       g = new Dygraph(
-              document.getElementById("demodiv"),
-              data,
-              {
-                labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
-                width: 640,
-                height: 350,
-                'Y3': {
-                  axis: {
-                    // set axis-related properties here
-                    labelsKMB: true
-                  }
-                },
-                'Y4': {
-                  axis: 'Y3'  // use the same y-axis as series Y3
-                }
+          document.getElementById("demodiv"),
+          data,
+          {
+            labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
+            'Y3': {
+              axis: {
               }
-          );
+            },
+            'Y4': {
+              axis: 'Y3'  // use the same y-axis as series Y3
+            },
+            axes: {
+              y2: {
+                // set axis-related properties here
+                labelsKMB: true
+              }
+            },
+            ylabel: 'Primary y-axis',
+            y2label: 'Secondary y-axis',
+            yAxisLabelWidth: 60
+          }
+      );
+
+      g2 = new Dygraph(
+          document.getElementById("demodiv_one"),
+          data,
+          {
+            labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
+            labelsKMB: true,
+            ylabel: 'Primary y-axis',
+            y2label: 'Secondary y-axis',
+          }
+      );
+
+      function update(el) {
+        g.updateOptions( { fillGraph: el.checked } );
+        g2.updateOptions( { fillGraph: el.checked } );
+      }
     </script>
+
+    <input type=checkbox id="check" onChange="update(this)"><label for="check"> Fill?</label>
 </body>
 </html>