3 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
4 <title>isZoomedIgnoresProgrammaticZoom Flag
</title>
6 <script type=
"text/javascript" src=
"../excanvas.js"></script>
8 <script type=
"text/javascript" src=
"../strftime/strftime-min.js"></script>
9 <script type=
"text/javascript" src=
"../rgbcolor/rgbcolor.js"></script>
10 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
11 <script type=
"text/javascript" src=
"../dygraph.js"></script>
12 <script type=
"text/javascript" src=
"data.js"></script>
15 <h1 id=
"zoom">Determining Zoom
</h1>
17 It is possible to detect whether a chart has been zoomed in either axis by the use of the
<code>isZoomed
</code> function.
18 If called with no argument, it will report whether
<em>either
</em> axis has been zoomed.
19 Alternatively it can be called with an argument of either
<code>'x'
</code> or
<code>'y'
</code> and it will report the status of just that axis.
22 <p>Here's a simple example using
<code>drawCallback
</code> to display the various zoom states whenever the chart is zoomed:
</p>
24 <div style=
"width:600px; text-align:center; font-weight: bold; font-size: 125%;">OUTPUT
</div>
25 <div style=
"width: 750px">
26 <div style=
"float: right">
27 <p>Zoomed:
<span id=
"zoomed">False
</span><p/>
28 <p>Zoomed X:
<span id=
"zoomedX">False
</span><p/>
29 <p>Zoomed Y:
<span id=
"zoomedY">False
</span><p/>
31 <div class=
"codeoutput" style=
"float:left;">
32 <div id=
"zoomdiv"></div>
33 <script type=
"text/javascript">
37 document.getElementById(
"zoomdiv"),
39 // CSV or path to a CSV file.
50 drawCallback: function(me, initial) {
51 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
52 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
53 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
62 <div style=
"clear:both; width:600px; text-align:center; font-weight: bold; font-size: 125%;">HTML
</div>
68 document.getElementById(
"zoomdiv
"),
70 // CSV or path to a CSV file.
71 "Date,Temperature
\n" +
72 "2011-
01-
07,
75\n" +
73 "2011-
01-
08,
70\n" +
74 "2011-
01-
09,
90\n" +
75 "2011-
01-
10,
30\n" +
76 "2011-
01-
11,
40\n" +
77 "2011-
01-
12,
60\n" +
78 "2011-
01-
13,
70\n" +
79 "2011-
01-
14,
40\n",
81 drawCallback: function(me, initial) {
82 document.getElementById(
"zoomed
").innerHTML =
"" + me.isZoomed();
83 document.getElementById(
"zoomedX
").innerHTML =
"" + me.isZoomed(
"x
");
84 document.getElementById(
"zoomedY
").innerHTML =
"" + me.isZoomed(
"y
");
91 <p>The
<a href=
"tests/zoom.html">Tests for zoom operations
</a> show a full example of this in action.
</p>
93 <h3>Programmatic Zoom
</h3>
95 When a chart is programmatically zoomed by updating either the
<code>dateWindow
</code>
96 or
<code>valueRange
</code> option, by default the zoomed flags are also updated correspondingly.
97 It is possible to prevent this by specifying the
<code>isZoomedIgnoreProgrammaticZoom
</code> in the same
98 call to the
<code>updateOptions
</code> method.
101 The
<a href=
"tests/is-zoomed-ignore-programmatic-zoom.html">is-zoomed-ignore-programmatic-zoom
</a> test shows this in operation.