X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=inline;f=tests%2Fzoom.html;h=65f23a4c20325c53213e0a1c5b5356342a940123;hb=b56b6993ddcd594f46d93c3fff74d1f41ab86ac3;hp=24a28288a96bf08fd75afd94c64b50df939381c2;hpb=937029dffe23b54b2269a180ece191c5625744e5;p=dygraphs.git
diff --git a/tests/zoom.html b/tests/zoom.html
index 24a2828..65f23a4 100644
--- a/tests/zoom.html
+++ b/tests/zoom.html
@@ -1,8 +1,10 @@
+
+
zoom
@@ -12,9 +14,10 @@
Click the buttons to change the zoom level or just use the normal
- click-and drag.
+ click-and drag. While zoom typically works by click-and-drag, the
+ buttons are useful for testing.
Window coordinates (in dates and values):
-
+
Zoom operations:
@@ -24,13 +27,17 @@
-
+
-
+
+
+
+
+
@@ -38,7 +45,10 @@
g = new Dygraph(
document.getElementById("div_g"),
NoisyData, {
- zoomCallback : function(a,b,c,d) { showDimensions(a,b,c,d); }
+ errorBars: true,
+ zoomCallback : function(minDate, maxDate, yRanges) {
+ showDimensions(minDate, maxDate, yRanges);
+ }
}
);
@@ -50,25 +60,46 @@
var maxDate = g.xAxisRange()[1];
var minValue = g.yAxisRange()[0];
var maxValue = g.yAxisRange()[1];
- showDimensions(minDate, maxDate, minValue, maxValue);
+ showDimensions(minDate, maxDate, [minValue, maxValue]);
- function showDimensions(minDate, maxDate, minValue, maxValue) {
- var elem = document.getElementById("dimensions");
- elem.innerHTML =
- "dateWindow : [" + minDate + " , "+ maxDate + "],
" +
- "valueRange : [" + minValue + " , "+ maxValue + "],";
+ function showDimensions(minDate, maxDate, yRanges) {
+ showXDimensions(minDate, maxDate);
+ showYDimensions(yRanges);
+ }
+
+ function showXDimensions(first, second) {
+ var elem = document.getElementById("xdimensions");
+ elem.innerHTML = "dateWindow : [" + first + ", "+ second + "]";
+ }
+
+ function showYDimensions(ranges) {
+ var elem = document.getElementById("ydimensions");
+ elem.innerHTML = "valueRange : [" + ranges + "]";
}
function zoomGraphX(minDate, maxDate) {
- g.doZoomXDates_(minDate, maxDate);
+ g.updateOptions({
+ dateWindow: [minDate, maxDate]
+ });
+ showXDimensions(minDate, maxDate);
}
function zoomGraphY(minValue, maxValue) {
- g.doZoomYValues_(minValue, maxValue);
+ g.updateOptions({
+ valueRange: [minValue, maxValue]
+ });
+ showYDimensions(g.yAxisRanges());
}
function unzoomGraph() {
- g.doUnzoom_();
+ g.updateOptions({
+ dateWindow: null,
+ valueRange: null
+ });
+ }
+
+ function panEdgeFraction(value) {
+ g.updateOptions({ panEdgeFraction : value });
}