Merge https://github.com/danvk/dygraphs into logscale
[dygraphs.git] / tests / logscale.html
index 20d4a1a..df76eda 100644 (file)
@@ -9,30 +9,56 @@
     <script type="text/javascript" src="../dygraph-canvas.js"></script>
     <script type="text/javascript" src="../dygraph.js"></script>
   </head>
-  <script>
 
-function NoisyData() {
-return "" +
-"Date,A\n" +
-"20061124,3.18584070796\n" +
-"20061125,2.83185840708\n" +
-"20061126,3.01953818828\n" +
-"20061127,2.81195079086\n" +
-"20061128,2.97723292469\n" +
-"20061129,1.41093474427";
-}
-  </script>
   <body>
     <h1>Log scale demo - work in progress</h1>
+    <h2>x-axis of dates</h2>
     <div id="div_g" style="width:600px; height:300px;"></div>
+    <h2>x-axis of numbers</h2>
+    <div id="div_g2" style="width:600px; height:300px;"></div>
       
     <input type="button" value="log scale" onclick="logScale()">
     <input type="button" value="linear scale" onclick="linearScale()">
     <script type="text/javascript">
+      function Data() {
+        return "Date,A\n" +
+        "20101201,5\n"+
+        "20101202,10\n"+
+        "20101203,100\n"+
+        "20101204,250\n"+
+        "20101205,1000\n"+
+        "20101206,30\n"+
+        "20101207,80\n"+
+        "20101208,100\n"+
+        "20101209,500\n"+
+        "";
+      }
       var g = new Dygraph(document.getElementById("div_g"),
-                     NoisyData, { logscale : true });
-      function logScale() { g.updateOptions({ logscale : true })}
-      function linearScale() { g.updateOptions({ logscale : null })}
+                      Data, { logscale : true });
+      function Data2() {
+        return "X,A\n" +
+        "1,0.000001\n"+
+        "2,10\n"+
+        "3,100\n"+
+        "4,250\n"+
+        "5,1000\n"+
+        "6,30\n"+
+        "7,80\n"+
+        "8,100\n"+
+        "9,500\n"+
+        "";
+      }
+      var g2 = new Dygraph(document.getElementById("div_g2"),
+                      Data2, { logscale : true });
+
+      function logScale() {
+        g.updateOptions({ logscale : true });
+        g2.updateOptions({ logscale : true });
+      }
+      function linearScale() {
+        g.updateOptions({ logscale : false });
+        g2.updateOptions({ logscale : false });
+      }
     </script>
 
   </body>