X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fzoom.html;h=a835dc379102c2e24d3c5365e3fedfc4a5b37c47;hb=77b5e09d8097138dfd4871db7a1240c787b916af;hp=1f5cac900bfe1b958e5d932e52e9fa97a2260dff;hpb=848b47c9adc94820b3e8110b2b1624bb0adbcc7d;p=dygraphs.git
diff --git a/tests/zoom.html b/tests/zoom.html
index 1f5cac9..a835dc3 100644
--- a/tests/zoom.html
+++ b/tests/zoom.html
@@ -1,23 +1,33 @@
+
+
zoom
-
-
-
-
+
+
+
Click the buttons to change the zoom level or just use the normal
click-and drag. While zoom typically works by click-and-drag, the
- butons are useful for testing.
+ buttons are useful for testing.
Window coordinates (in dates and values):
-
+
+
+
Zoomed: False
+
Zoomed X: False
+
Zoomed Y: False
+
+
Zoom operations:
@@ -25,13 +35,17 @@
-
+
-
+
+
+
+
+
@@ -39,7 +53,15 @@
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, yRange) {
+ showDimensions(minDate, maxDate, yRange);
+ },
+ drawCallback: function(me, initial) {
+ document.getElementById("zoomed").innerHTML = "" + me.isZoomed();
+ document.getElementById("zoomedX").innerHTML = "" + me.isZoomed("x");
+ document.getElementById("zoomedY").innerHTML = "" + me.isZoomed("y");
+ }
}
);
@@ -51,25 +73,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, yRanges) {
+ showXDimensions(minDate, maxDate);
+ showYDimensions(yRanges);
+ }
- function showDimensions(minDate, maxDate, minValue, maxValue) {
- var elem = document.getElementById("dimensions");
- elem.innerHTML =
- "dateWindow : [" + minDate + " , "+ maxDate + "], " +
- "valueRange : [" + minValue + " , "+ maxValue + "],";
+ 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 });
}