X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fzoom.html;h=62252a15727920f87d9c98f47c442266e9807379;hb=a6cc9f3e09748d3764320481753c44e579a7661a;hp=0c214464e3ecf684a03f7d69130ab4baa15626e8;hpb=8b83c6cc6495cf8a22ed2af673736e774a29ca1d;p=dygraphs.git
diff --git a/tests/zoom.html b/tests/zoom.html
index 0c21446..62252a1 100644
--- a/tests/zoom.html
+++ b/tests/zoom.html
@@ -1,6 +1,6 @@
- noise
+ zoom
@@ -11,18 +11,27 @@
- Click the buttons to change the 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
+ buttons are useful for testing.
Window coordinates (in dates and values):
-
+
Zoom operations:
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30,6 +39,7 @@
g = new Dygraph(
document.getElementById("div_g"),
NoisyData, {
+ errorBars: true,
zoomCallback : function(a,b,c,d) { showDimensions(a,b,c,d); }
}
);
@@ -42,23 +52,42 @@
var maxDate = g.xAxisRange()[1];
var minValue = g.yAxisRange()[0];
var maxValue = g.yAxisRange()[1];
-
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.updateOptions({
+ dateWindow: [minDate, maxDate]
+ });
+ showXDimensions(minDate, maxDate);
+ }
+
+ function zoomGraphY(minValue, maxValue) {
+ g.updateOptions({
+ valueRange: [minValue, maxValue]
+ });
+ showYDimensions(minValue, maxValue);
}
- function sizeGraph(i) {
- switch(i) {
- case 1: g.doZoomYValues_(4, 2);
- break;
- case 5: g.doUnzoom_();
- break;
- }
+ function unzoomGraph() {
+ g.updateOptions({
+ dateWindow: null,
+ valueRange: null
+ });
}