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>
9 For production (minified) code, use:
10 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
12 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
14 <script type=
"text/javascript" src=
"data.js"></script>
17 <h1 id=
"zoom">Determining Zoom
</h1>
19 It is possible to detect whether a chart has been zoomed in either axis by the use of the
<code>isZoomed
</code> function.
20 If called with no argument, it will report whether
<em>either
</em> axis has been zoomed.
21 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.
24 <p>Here's a simple example using
<code>drawCallback
</code> to display the various zoom states whenever the chart is zoomed:
</p>
26 <div style=
"width:600px; text-align:center; font-weight: bold; font-size: 125%;">OUTPUT
</div>
27 <div style=
"width: 750px">
28 <div style=
"float: right">
29 <p>Zoomed:
<span id=
"zoomed">False
</span><p/>
30 <p>Zoomed X:
<span id=
"zoomedX">False
</span><p/>
31 <p>Zoomed Y:
<span id=
"zoomedY">False
</span><p/>
33 <div class=
"codeoutput" style=
"float:left;">
34 <div id=
"zoomdiv"></div>
35 <script type=
"text/javascript">
39 document.getElementById(
"zoomdiv"),
41 // CSV or path to a CSV file.
52 drawCallback: function(me, initial) {
53 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
54 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
55 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
64 <div style=
"clear:both; width:600px; text-align:center; font-weight: bold; font-size: 125%;">HTML
</div>
70 document.getElementById(
"zoomdiv
"),
72 // CSV or path to a CSV file.
73 "Date,Temperature
\n" +
74 "2011-
01-
07,
75\n" +
75 "2011-
01-
08,
70\n" +
76 "2011-
01-
09,
90\n" +
77 "2011-
01-
10,
30\n" +
78 "2011-
01-
11,
40\n" +
79 "2011-
01-
12,
60\n" +
80 "2011-
01-
13,
70\n" +
81 "2011-
01-
14,
40\n",
83 drawCallback: function(me, initial) {
84 document.getElementById(
"zoomed
").innerHTML =
"" + me.isZoomed();
85 document.getElementById(
"zoomedX
").innerHTML =
"" + me.isZoomed(
"x
");
86 document.getElementById(
"zoomedY
").innerHTML =
"" + me.isZoomed(
"y
");
93 <p>The
<a href=
"tests/zoom.html">Tests for zoom operations
</a> show a full example of this in action.
</p>
95 <h3>Programmatic Zoom
</h3>
97 When a chart is programmatically zoomed by updating either the
<code>dateWindow
</code>
98 or
<code>valueRange
</code> option, by default the zoomed flags are also updated correspondingly.
99 It is possible to prevent this by specifying the
<code>isZoomedIgnoreProgrammaticZoom
</code> in the same
100 call to the
<code>updateOptions
</code> method.
103 The
<a href=
"tests/is-zoomed-ignore-programmatic-zoom.html">is-zoomed-ignore-programmatic-zoom
</a> test shows this in operation.