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);
};
* @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();
}
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];
- var minValue = this.xAxisRange()[0];
- var maxValue = this.xAxisRange()[1];
+ var minValue = this.yAxisRange()[0];
+ var maxValue = this.yAxisRange()[1];
this.attr_("zoomCallback")(minDate, maxDate, minValue, maxValue);
}
- this.drawGraph_(this.rawData_);
}
};