X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fzoom.html;h=8c9e64141ea6934f2c0e1a299f7f195ec1066275;hb=37567cceaeaee48596653c1b59adb12fca8dbc26;hp=608ae6dfd10b8767045a891b39f8a270e556ff31;hpb=437c097971f7b20e593e256385bbc998c781e1d2;p=dygraphs.git diff --git a/tests/zoom.html b/tests/zoom.html index 608ae6d..8c9e641 100644 --- a/tests/zoom.html +++ b/tests/zoom.html @@ -1,6 +1,6 @@
-Zoomed: False
+Zoomed X: False
+Zoomed Y: False
+Zoom operations:
-
+
@@ -38,7 +45,15 @@
g = new Dygraph(
document.getElementById("div_g"),
NoisyData, {
- zoomCallback : function(a,b,c,d) { showDimensions(a,b,c,d); }
+ errorBars: true,
+ zoomCallback : function(a,b,c,d) {
+ showDimensions(a,b,c,d);
+ },
+ drawCallback: function(me, initial) {
+ document.getElementById("zoomed").innerHTML = me.zoomed ? "True" : "False";
+ document.getElementById("zoomedX").innerHTML = me.zoomedX ? "True" : "False";
+ document.getElementById("zoomedY").innerHTML = me.zoomedY ? "True" : "False";
+ }
}
);
@@ -53,22 +68,39 @@
showDimensions(minDate, maxDate, minValue, maxValue);
function showDimensions(minDate, maxDate, minValue, maxValue) {
- var elem = document.getElementById("dimensions");
- elem.innerHTML =
- "dateWindow : [" + minDate + " , "+ maxDate + "],
" +
- "valueRange : [" + minValue + " , "+ maxValue + "],";
+ showXDimensions(minDate, maxDate);
+ showYDimensions(minValue, maxValue);
+ }
+
+ function showXDimensions(first, second) {
+ var elem = document.getElementById("xdimensions");
+ elem.innerHTML = "dateWindow : [" + first + ", "+ second + "]";
+ }
+
+ function showYDimensions(first, second) {
+ var elem = document.getElementById("ydimensions");
+ elem.innerHTML = "valueRange : [" + first + ", "+ second + "]";
}
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(minValue, maxValue);
}
function unzoomGraph() {
- g.doUnzoom_();
+ g.updateOptions({
+ dateWindow: null,
+ valueRange: null
+ });
}