X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=plugins%2Frange-selector.js;h=fe32b1a26276bb04a24cf4bae4a5b94a23c6966e;hb=df75aef5d3eb2056253841c2522e61ecf5dc53a2;hp=d226ebafd05c4f8d64ac0bd620d089005eca89cb;hpb=db6a9f5a2c20a8ca30656b8c6dfc929d137edef4;p=dygraphs.git diff --git a/plugins/range-selector.js b/plugins/range-selector.js index d226eba..fe32b1a 100644 --- a/plugins/range-selector.js +++ b/plugins/range-selector.js @@ -268,7 +268,7 @@ rangeSelector.prototype.createZoomHandles_ = function() { */ rangeSelector.prototype.initInteraction_ = function() { var self = this; - var topElem = this.isIE_ ? document : window; + var topElem = document; var clientXLast = 0; var handle = null; var isZooming = false; @@ -648,14 +648,13 @@ rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { var logscale = this.getOption_('logscale'); // Create a combined series (average of all series values). - var i, j; - var xVal, yVal; + var i; // TODO(danvk): short-circuit if there's only one series. var rolledSeries = []; var dataHandler = g.dataHandler_; var options = g.attributes_; - for (var i = 1; i < g.numColumns(); i++) { + for (i = 1; i < g.numColumns(); i++) { var series = dataHandler.extractSeries(g.rawData_, i, options); if (g.rollPeriod() > 1) { series = dataHandler.rollingAverage(series, g.rollPeriod(), options); @@ -668,7 +667,7 @@ rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { for (i = 0; i < rolledSeries[0].length; i++) { var sum = 0; var count = 0; - for (j = 0; j < rolledSeries.length; j++) { + for (var j = 0; j < rolledSeries.length; j++) { var y = rolledSeries[j][i][1]; if (y === null || isNaN(y)) continue; count++; @@ -681,7 +680,7 @@ rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { var yMin = Number.MAX_VALUE; var yMax = -Number.MAX_VALUE; for (i = 0; i < combinedSeries.length; i++) { - yVal = combinedSeries[i][1]; + var yVal = combinedSeries[i][1]; if (yVal !== null && isFinite(yVal) && (!logscale || yVal > 0)) { yMin = Math.min(yMin, yVal); yMax = Math.max(yMax, yVal);