3 <link rel=
"stylesheet" href=
"../css/dygraph.css">
4 <title>isZoomedIgnoreProgrammaticZoom Flag
</title>
6 For production (minified) code, use:
7 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
9 <script type=
"text/javascript" src=
"../dist/dygraph.js"></script>
11 <script type=
"text/javascript" src=
"data.js"></script>
14 <!-- Ensure that the documentation generator picks us up: {isZoomedIgnoreProgrammaticZoom:} --
>
15 <h1>isZoomedIgnoreProgrammaticZoom Option
</h1>
17 By default, when the
<code>dateWindow
</code> or
<code>updateOptions
</code>
18 of a chart is changed programmatically by a call to
<code>updateOptions
</code>
19 the zoomed flags (
<code>isZoomed
</code>) are changed. This is the same
20 as manually zooming in using the mouse.
23 Sometimes it may be desirable to change the display of the chart by
24 manipulating the
<code>dateWindow
</code> and
<code>valueRange
</code>
25 options but without changing the zoomed flags, for example where manual
26 zooming is still required but where it is also desired that the zoomed
27 flags drive display elements, but only for manual zooming.
30 In this case
<code>isZoomedIgnoreProgrammaticZoom
</code> may be specified along with
31 either the
<code>dateWindow
</code> or
<code>valueRange
</code> values to
32 <code>updateOptions
</code> and the zoomed flags will remain unaffected.
35 The chart below may be manipulated to change the
<code>updateOptions
</code>
36 using the Max and Min Y axis buttons and the
<code>dateWindow
</code>
37 by using the Max and Min X axis buttons.
40 Toggle the check box below to determine the difference in operation of the zoom flags
41 when the date and value windows of the chart are changed using the arrows underneath.
43 <p><input id=
"isZoomedIgnoreProgrammaticZoom" type=
"checkbox" checked=true
/>Do not change zoom flags (
<code>isZoomedIgnoreProgrammaticZoom
</code>)
</p>
46 <div style=
"float: left">
49 <input type=
"button" value=
"↑" onclick=
"adjustTop(+1)" />
50 <input type=
"button" value=
"↓" onclick=
"adjustTop(-1)" />
54 <input type=
"button" value=
"↑" onclick=
"adjustBottom(+1)" />
55 <input type=
"button" value=
"↓" onclick=
"adjustBottom(-1)" />
59 <input type=
"button" value=
"←" onclick=
"adjustFirst(-100000000)" />
60 <input type=
"button" value=
"→" onclick=
"adjustFirst(+100000000)" />
64 <input type=
"button" value=
"←" onclick=
"adjustLast(-100000000)" />
65 <input type=
"button" value=
"→" onclick=
"adjustLast(+100000000)" />
68 <div id=
"div_g" style=
"width: 600px; height: 300px; float: left"></div>
69 <div style=
"float: left">
73 <div style=
"display: inline-block">
74 <h4> Zoomed Flags
</h4>
75 <p>Zoomed:
<span id=
"zoomed">False
</span></p>
76 <p>Zoomed X:
<span id=
"zoomedX">False
</span></p>
77 <p>Zoomed Y:
<span id=
"zoomedY">False
</span></p>
78 <h4>Window coordinates (in dates and values):
</h4>
79 <div id=
"xdimensions"></div>
80 <div id=
"ydimensions"></div>
83 <script type=
"text/javascript">
85 document.getElementById(
"div_g"),
89 zoomCallback : function(minDate, maxDate, yRange) {
90 showDimensions(minDate, maxDate, yRange);
92 drawCallback: function(me, initial) {
93 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
94 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
95 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
96 var x_range = me.xAxisRange()
97 var elem = document.getElementById(
"xdimensions")
98 elem.innerHTML =
"dateWindow : [" + x_range[
0] +
", "+ x_range[
1] +
"]"
103 // Pull an initial value for logging.
104 var minDate = g.xAxisRange()[
0];
105 var maxDate = g.xAxisRange()[
1];
106 var minValue = g.yAxisRange()[
0];
107 var maxValue = g.yAxisRange()[
1];
108 showDimensions(minDate, maxDate, [minValue, maxValue]);
110 function showDimensions(minDate, maxDate, yRanges) {
111 showXDimensions(minDate, maxDate);
112 showYDimensions(yRanges);
115 function getNoChange() {
117 var elem = document.getElementById(
"isZoomedIgnoreProgrammaticZoom")
119 options.isZoomedIgnoreProgrammaticZoom = true
124 function adjustTop(value) {
125 options = getNoChange()
127 options.valueRange = [minValue, maxValue]
129 g.updateOptions(options)
132 function adjustBottom(value) {
133 options = getNoChange()
135 options.valueRange = [minValue, maxValue]
137 g.updateOptions(options)
140 function adjustFirst(value) {
141 options = getNoChange()
143 options.dateWindow = [minDate, maxDate]
145 g.updateOptions(options)
148 function adjustLast(value) {
149 options = getNoChange()
151 options.dateWindow = [minDate, maxDate]
152 g.updateOptions(options)
155 function showXDimensions(first, second) {
156 var elem = document.getElementById(
"xdimensions");
157 elem.innerHTML =
"dateWindow: [" + first +
", "+ second +
"]";
160 function showYDimensions(ranges) {
161 var elem = document.getElementById(
"ydimensions");
162 elem.innerHTML =
"valueRange: [" + ranges +
"]";