X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=26aff3a19d83f0007f38e2efb6503a8e57b64f92;hb=92fd68d8d81bbe54bae58e4c02c9a2466cab966c;hp=5030123675ca070ea98cf73676d5d7ba06456d75;hpb=a109b711162a7db710f3bb18fdc4e925d61cd330;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 5030123..26aff3a 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2635,6 +2635,20 @@ 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]; @@ -3240,6 +3254,11 @@ Dygraph.prototype.parseDataTable_ = function(data) { annotations.push(ann); } } + + // Strip out infinities, which give dygraphs problems later on. + for (var j = 0; j < row.length; j++) { + if (!isFinite(row[j])) row[j] = null; + } } else { for (var j = 0; j < cols - 1; j++) { row.push([ data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j) ]); @@ -3248,11 +3267,6 @@ Dygraph.prototype.parseDataTable_ = function(data) { if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) { outOfOrder = true; } - - // Strip out infinities, which give dygraphs problems later on. - for (var j = 0; j < row.length; j++) { - if (!isFinite(row[j])) row[j] = null; - } ret.push(row); }