X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=5a8b9ca1eb052cc29ec666dfa9a4dda1d2cf9e3f;hb=937029dffe23b54b2269a180ece191c5625744e5;hp=36986d8a642c4f6a5837d090a2a9559b52dbccd6;hpb=a2db51b539e5a5db661501a10e8925249218cd15;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 36986d8..5a8b9ca 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1012,9 +1012,9 @@ Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) { Dygraph.prototype.doZoomY_ = function(lowY, highY) { // Find the highest and lowest values in pixel range. var r = this.toDataCoords(null, lowY); - var minValue = r[1]; - r = this.toDataCoords(null, highY); var maxValue = r[1]; + r = this.toDataCoords(null, highY); + var minValue = r[1]; this.doZoomYValues_(minValue, maxValue); }; @@ -1029,7 +1029,7 @@ Dygraph.prototype.doZoomY_ = function(lowY, highY) { * @private */ Dygraph.prototype.doZoomYValues_ = function(minValue, maxValue) { - this.valueWindow_ = [maxValue, minValue]; + this.valueWindow_ = [minValue, maxValue]; this.drawGraph_(this.rawData_); if (this.attr_("zoomCallback")) { var xRange = this.xAxisRange(); @@ -1055,6 +1055,9 @@ Dygraph.prototype.doUnzoom_ = function() { } if (dirty) { + // Putting the drawing operation before the callback because it resets + // yAxisRange. + this.drawGraph_(this.rawData_); if (this.attr_("zoomCallback")) { var minDate = this.rawData_[0][0]; var maxDate = this.rawData_[this.rawData_.length - 1][0]; @@ -1062,7 +1065,6 @@ Dygraph.prototype.doUnzoom_ = function() { var maxValue = this.yAxisRange()[1]; this.attr_("zoomCallback")(minDate, maxDate, minValue, maxValue); } - this.drawGraph_(this.rawData_); } };