From: Neal Nelson
+ It is possible to detect whether a chart has been zoomed in either axis by the use of the Here's a simple example using Zoomed: False Zoomed X: False Zoomed Y: False
+ Determining Zoom
+
+ isZoomed
function.
+ If called with no argument, it will report whether either axis has been zoomed.
+ Alternatively it can be called with an argument of either 'x'
or 'y'
and it will report the status of just that axis.
+ drawCallback
to display the various zoom states whenever the chart is zoomed:
+ new Dygraph(
+
+ // containing div
+ document.getElementById("zoomdiv"),
+
+ // CSV or path to a CSV file.
+ "Date,Temperature\n" +
+ "2011-01-07,75\n" +
+ "2011-01-08,70\n" +
+ "2011-01-09,90\n" +
+ "2011-01-10,30\n" +
+ "2011-01-11,40\n" +
+ "2011-01-12,60\n" +
+ "2011-01-13,70\n" +
+ "2011-01-14,40\n",
+ {
+ drawCallback: function(me, initial) {
+ document.getElementById("zoomed").innerHTML = "" + me.isZoomed();
+ document.getElementById("zoomedX").innerHTML = "" + me.isZoomed("x");
+ document.getElementById("zoomedY").innerHTML = "" + me.isZoomed("y");
+ }
+ }
+ );
+
+
The Tests for zoom operations show a full example of this in action.
+This chart shows monthly closes of the Dow Jones Industrial Average, both in nominal and real (i.e. adjusted for inflation) dollars. The shaded areas show its monthly high and low. CPI values with a base from 1982-84 are used to adjust for inflation.
@@ -730,7 +809,7 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high)interger
integer
1
boolean
true