From: Neal Nelson Date: Tue, 12 Oct 2010 14:06:41 +0000 (+0200) Subject: Fix problem with evaluating the limits of data containing null series'. X-Git-Tag: v1.0.0~634 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=488411446052d1f25a6a732b9d057ab8f1d9aa65;p=dygraphs.git Fix problem with evaluating the limits of data containing null series'. --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index fb724e1..8801f1b 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -69,11 +69,13 @@ DygraphLayout.prototype._evaluateLimits = function() { for (var name in this.datasets) { if (!this.datasets.hasOwnProperty(name)) continue; var series = this.datasets[name]; - var x1 = series[0][0]; - if (!this.minxval || x1 < this.minxval) this.minxval = x1; - - var x2 = series[series.length - 1][0]; - if (!this.maxxval || x2 > this.maxxval) this.maxxval = x2; + if (series.length > 1) { + var x1 = series[0][0]; + if (!this.minxval || x1 < this.minxval) this.minxval = x1; + + var x2 = series[series.length - 1][0]; + if (!this.maxxval || x2 > this.maxxval) this.maxxval = x2; + } } } this.xrange = this.maxxval - this.minxval;