From: Adam Vartanian Date: Tue, 5 Apr 2011 16:36:22 +0000 (-0400) Subject: Change no-series-defined behavior so that it computes the X-Git-Tag: v1.0.0~535 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=06fc69b6a0b2d0d8aff61f6cb557e7b49ad9fceb;p=dygraphs.git Change no-series-defined behavior so that it computes the extreme range. This still allows zooming in and respecting user-defined ranges even when no series are present. --- diff --git a/dygraph.js b/dygraph.js index fe677f2..19eccb2 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2770,25 +2770,14 @@ Dygraph.prototype.computeYAxisRanges_ = function(extremes) { seriesForAxis[idx].push(series); } - // If no series are defined or visible then fill in some reasonable defaults. - if (seriesForAxis.length == 0) { - var axis = this.axes_[0]; - axis.computedValueRange = [0, 1]; - var ret = - Dygraph.numericTicks(axis.computedValueRange[0], - axis.computedValueRange[1], - this, - axis); - axis.ticks = ret.ticks; - this.numYDigits_ = ret.numDigits; - return; - } - // Compute extreme values, a span and tick marks for each axis. for (var i = 0; i < this.axes_.length; i++) { var axis = this.axes_[i]; - { + if (!seriesForAxis[i]) { + // If no series are defined or visible then use a reasonable default + axis.extremeRange = [0, 1]; + } else { // Calculate the extremes of extremes. var series = seriesForAxis[i]; var minY = Infinity; // extremes[series[0]][0];