zoom.html needed a little love.
authorRobert Konigsberg <konigsberg@google.com>
Thu, 23 Sep 2010 20:56:54 +0000 (16:56 -0400)
committerRobert Konigsberg <konigsberg@google.com>
Thu, 23 Sep 2010 20:56:54 +0000 (16:56 -0400)
dygraph.js
tests/zoom.html

index 2ae8cd9..36986d8 100644 (file)
@@ -1058,8 +1058,8 @@ Dygraph.prototype.doUnzoom_ = function() {
     if (this.attr_("zoomCallback")) {
       var minDate = this.rawData_[0][0];
       var maxDate = this.rawData_[this.rawData_.length - 1][0];
-      var minValue = this.xAxisRange()[0];
-      var maxValue = this.xAxisRange()[1];
+      var minValue = this.yAxisRange()[0];
+      var maxValue = this.yAxisRange()[1];
       this.attr_("zoomCallback")(minDate, maxDate, minValue, maxValue);
     }
     this.drawGraph_(this.rawData_);
index 0c21446..c59284a 100644 (file)
 
     <p><b>Zoom operations:</b></p>
     <p>
-      <input type="button" value="Zoom operation 1" onclick="sizeGraph(1)">&nbsp;
-      <input type="button" value="Zoom operation 2" onclick="sizeGraph(2)">&nbsp;
-      <input type="button" value="Zoom operation 3" onclick="sizeGraph(3)">&nbsp;
-      <input type="button" value="Zoom operation 4" onclick="sizeGraph(4)">&nbsp;
-      <input type="button" value="Unzoom" onclick="sizeGraph(5)">&nbsp;
+      <input type="button" value="Y (3,5)" onclick="sizeGraph(1)">&nbsp;
+      <input type="button" value="Y (0,4)" onclick="sizeGraph(2)">&nbsp;
+      <input type="button" value="Y (2,4)" onclick="sizeGraph(3)">&nbsp;
+      <input type="button" value="Y (0,2)" onclick="sizeGraph(4)">&nbsp;
+      <input type="button" value="Y (1,0)" onclick="sizeGraph(5)">&nbsp;
+      <input type="button" value="Unzoom" onclick="sizeGraph(0)">&nbsp;
       </p>
 
 
 
       function sizeGraph(i) {
         switch(i) {
-          case 1: g.doZoomYValues_(4, 2);
+          case 0: g.doUnzoom_();
+                  break;
+          case 1: g.doZoomYValues_(5, 3);
+                  break;
+          case 2: g.doZoomYValues_(4, 0);
+                  break;
+          case 3: g.doZoomYValues_(4, 2);
+                  break;
+          case 4: g.doZoomYValues_(2, 0);
+                  break;
+          case 5: g.doZoomYValues_(1, 0);
                   break;
-          case 5: g.doUnzoom_();
-                    break;
         }
       }
     </script>