- // Find the highest and lowest values in pixel range.
- var r = this.toDataCoords(null, lowY);
- var maxValue = r[1];
- r = this.toDataCoords(null, highY);
- var minValue = r[1];
-
- this.doZoomYValues_(minValue, maxValue);
-};
+ // Find the highest and lowest values in pixel range for each axis.
+ // Note that lowY (in pixels) corresponds to the max Value (in data coords).
+ // This is because pixels increase as you go down on the screen, whereas data
+ // coordinates increase as you go up the screen.
+ var valueRanges = [];
+ for (var i = 0; i < this.axes_.length; i++) {
+ var hi = this.toDataCoords(null, lowY, i);
+ var low = this.toDataCoords(null, highY, i);
+ this.axes_[i].valueWindow = [low[1], hi[1]];
+ valueRanges.push([low[1], hi[1]]);
+ }