3 <title>noZoomFlagChange Flag
</title>
5 <script type=
"text/javascript" src=
"../excanvas.js"></script>
7 <script type=
"text/javascript" src=
"../strftime/strftime-min.js"></script>
8 <script type=
"text/javascript" src=
"../rgbcolor/rgbcolor.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
10 <script type=
"text/javascript" src=
"../dygraph.js"></script>
11 <script type=
"text/javascript" src=
"data.js"></script>
14 <h1>noZoomFlagChange Operation
</h1>
16 By default, when the
<code>dateWindow
</code> or
<code>updateOptions
</code>
17 of a chart is changed programmatically by a call to
<code>updateOptions
</code>
18 the zoomed flags (
<code>isZoomed
</code>) are changed. This is the same
19 as manually zooming in using the mouse.
22 Sometimes it may be desirable to change the display of the chart by
23 manipulating the
<code>dateWindow
</code> and
<code>valueRange
</code>
24 options but without changing the zoomed flags, for example where manual
25 zooming is still required but where it is also desired that the zoomed
26 flags drive display elements, but only for manual zooming.
29 In this case
<code>noZoomFlagChange
</code> may be specified along with
30 either the
<code>dateWindow
</code> or
<code>valueRange
</code> values to
31 <code>updateOptions
</code> and the zoomed flags will remain unaffected.
34 The chart below may be manipulated to change the
<code>updateOptions
</code>
35 using the Max and Min Y axis buttons and the
<code>dateWindow
</code>
36 by using the Max and Min X axis buttons.
39 Toggle the check box below to determine the difference in operation of the zoom flags
40 when the date and value windows of the chart are changed using the arrows underneath.
42 <p><input id=
"noZoomFlagChange" type=
"checkbox" checked=true
/>Do not change zoom flags (
<code>noZoomFlagChange
</code>)
</p>
45 <div style=
"float: left">
48 <input type=
"button" value=
"↑" onclick=
"adjustTop(+1)" />
49 <input type=
"button" value=
"↓" onclick=
"adjustTop(-1)" />
53 <input type=
"button" value=
"↑" onclick=
"adjustBottom(+1)" />
54 <input type=
"button" value=
"↓" onclick=
"adjustBottom(-1)" />
58 <input type=
"button" value=
"←" onclick=
"adjustFirst(-100000000)" />
59 <input type=
"button" value=
"→" onclick=
"adjustFirst(+100000000)" />
63 <input type=
"button" value=
"←" onclick=
"adjustLast(-100000000)" />
64 <input type=
"button" value=
"→" onclick=
"adjustLast(+100000000)" />
67 <div id=
"div_g" style=
"width: 600px; height: 300px; float: left"></div>
68 <div style=
"float: left">
72 <div style=
"display: inline-block">
73 <h4> Zoomed Flags
</h4>
74 <p>Zoomed:
<span id=
"zoomed">False
</span></p>
75 <p>Zoomed X:
<span id=
"zoomedX">False
</span></p>
76 <p>Zoomed Y:
<span id=
"zoomedY">False
</span></p>
77 <h4>Window coordinates (in dates and values):
</h4>
78 <div id=
"xdimensions"></div>
79 <div id=
"ydimensions"></div>
82 <script type=
"text/javascript">
84 document.getElementById(
"div_g"),
88 zoomCallback : function(minDate, maxDate, yRange) {
89 showDimensions(minDate, maxDate, yRange);
91 drawCallback: function(me, initial) {
92 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
93 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
94 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
95 var x_range = me.xAxisRange()
96 var elem = document.getElementById(
"xdimensions")
97 elem.innerHTML =
"dateWindow : [" + x_range[
0] +
", "+ x_range[
1] +
"]"
102 // Pull an initial value for logging.
103 var minDate = g.xAxisRange()[
0];
104 var maxDate = g.xAxisRange()[
1];
105 var minValue = g.yAxisRange()[
0];
106 var maxValue = g.yAxisRange()[
1];
107 showDimensions(minDate, maxDate, [minValue, maxValue]);
109 function showDimensions(minDate, maxDate, yRanges) {
110 showXDimensions(minDate, maxDate);
111 showYDimensions(yRanges);
114 function getNoChange() {
116 var elem = document.getElementById(
"noZoomFlagChange")
118 options.noZoomFlagChange = true
123 function adjustTop(value) {
124 options = getNoChange()
126 options.valueRange = [minValue, maxValue]
128 g.updateOptions(options)
131 function adjustBottom(value) {
132 options = getNoChange()
134 options.valueRange = [minValue, maxValue]
136 g.updateOptions(options)
139 function adjustFirst(value) {
140 options = getNoChange()
142 options.dateWindow = [minDate, maxDate]
144 g.updateOptions(options)
147 function adjustLast(value) {
148 options = getNoChange()
150 options.dateWindow = [minDate, maxDate]
151 g.updateOptions(options)
154 function showXDimensions(first, second) {
155 var elem = document.getElementById(
"xdimensions");
156 elem.innerHTML =
"dateWindow: [" + first +
", "+ second +
"]";
159 function showYDimensions(ranges) {
160 var elem = document.getElementById(
"ydimensions");
161 elem.innerHTML =
"valueRange: [" + ranges +
"]";