From: Robert Konigsberg Date: Sun, 21 Nov 2010 02:23:28 +0000 (-0500) Subject: Fix reporting error with dygraphs (used to show two min/max, now passes array.) X-Git-Tag: v1.0.0~599^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=f0f2aef666950ea136e1ede7bc286ccb07c2c6b6;p=dygraphs.git Fix reporting error with dygraphs (used to show two min/max, now passes array.) --- diff --git a/dygraph.js b/dygraph.js index c24f4f3..7d64bb9 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1086,8 +1086,7 @@ Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) { this.dateWindow_ = [minDate, maxDate]; this.drawGraph_(); if (this.attr_("zoomCallback")) { - var yRange = this.yAxisRange(); - this.attr_("zoomCallback")(minDate, maxDate, yRange[0], yRange[1]); + this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRange()); } }; diff --git a/tests/zoom.html b/tests/zoom.html index a7ebae3..10b0457 100644 --- a/tests/zoom.html +++ b/tests/zoom.html @@ -40,8 +40,8 @@ document.getElementById("div_g"), NoisyData, { errorBars: true, - zoomCallback : function(minDate, maxDate, minValue, maxValue) { - showDimensions(minDate, maxDate, minValue, maxValue); + zoomCallback : function(minDate, maxDate, yRange) { + showDimensions(minDate, maxDate, yRange); } } ); @@ -52,13 +52,12 @@ // Pull an initial value for logging. var minDate = g.xAxisRange()[0]; var maxDate = g.xAxisRange()[1]; - var minValue = g.yAxisRange()[0]; - var maxValue = g.yAxisRange()[1]; - showDimensions(minDate, maxDate, minValue, maxValue); + var minValue = g.yAxisRange(); + showDimensions(minDate, maxDate, yAxisRange); - function showDimensions(minDate, maxDate, minValue, maxValue) { + function showDimensions(minDate, maxDate, yAxisRange) { showXDimensions(minDate, maxDate); - showYDimensions(minValue, maxValue); + showYDimensions(yAxisRange); } function showXDimensions(first, second) { @@ -66,9 +65,9 @@ elem.innerHTML = "dateWindow : [" + first + ", "+ second + "]"; } - function showYDimensions(first, second) { + function showYDimensions(range) { var elem = document.getElementById("ydimensions"); - elem.innerHTML = "valueRange : [" + first + ", " + second + "]"; + elem.innerHTML = "valueRange : [" + range + "]"; } function zoomGraphX(minDate, maxDate) {