Merging the two demos, and cleaned it up a little bit.
authorRobert Konigsberg <konigsberg@google.com>
Mon, 31 Jan 2011 17:07:31 +0000 (12:07 -0500)
committerRobert Konigsberg <konigsberg@google.com>
Mon, 31 Jan 2011 17:07:31 +0000 (12:07 -0500)
tests/logscale-zero.html [deleted file]
tests/logscale.html

diff --git a/tests/logscale-zero.html b/tests/logscale-zero.html
deleted file mode 100644 (file)
index bbbc0ee..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-  <head>
-    <title>log scale</title>
-    <!--[if IE]>
-    <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>
-  </head>
-
-  <body>
-    <h1>Log scale demo - verify that only positive values are shown.</h1>
-    <div id="div_g" 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,-1\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"),
-                     Data, { logscale : true});
-
-      function logScale() {
-        g.updateOptions({ logscale : true });
-      }
-      function linearScale() {
-        g.updateOptions({ logscale : false });
-      }
-    </script>
-
-  </body>
-</html>
index f564f25..0034be7 100644 (file)
   </head>
 
   <body>
-    <h1>Log scale demo</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()">
+    <center>
+           <input id='log' type="button" value="log scale" onclick="setLogScale(true)">
+           <input id='linear' type="button" value="linear scale" onclick="setLogScale(false)">
+    </center>
+
+    <h2>X axis of dates<h2>
+    <div id="div_g0" style="width:600px; height:300px;"></div>
+
+    <h2>X axis of numbers<h2>
+    <div id="div_g1" style="width:600px; height:300px;"></div>
+
     <script type="text/javascript">
-      function Data() {
+      function data0() {
         return "Date,A\n" +
         "20101201,5\n"+
         "20101202,10\n"+
-        "20101203,100\n"+
+        "20101203,-1\n"+
         "20101204,250\n"+
         "20101205,1000\n"+
         "20101206,30\n"+
         "20101208,100\n"+
         "20101209,500\n"+
         "";
-      }
-      var g = new Dygraph(document.getElementById("div_g"),
-                      Data, { logscale : true });
-      function Data2() {
+      };
+      function data1() {
         return "X,A\n" +
         "1,0.000001\n"+
         "2,10\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 });
+      var g0 = new Dygraph(document.getElementById("div_g0"),
+                      data0, { logscale : true });
+      var g1 = new Dygraph(document.getElementById("div_g1"),
+                      data1, { logscale : true });
+      function setLogScale(val) {
+        g0.updateOptions({ logscale: val });
+        g1.updateOptions({ logscale: val });
+        document.getElementById("linear").disabled = !val;
+        document.getElementById("log").disabled = val;
       }
     </script>