X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=e28c273bac2342397736ed803c2fa1b9399d4d86;hb=f99d913cd73b0d91850c09985237f6683713cdd2;hp=7d64bb9d8e8ad7e370688db9a4c3a2b06134a9b9;hpb=f0f2aef666950ea136e1ede7bc286ccb07c2c6b6;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 7d64bb9..e28c273 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1086,7 +1086,7 @@ Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) { this.dateWindow_ = [minDate, maxDate]; this.drawGraph_(); if (this.attr_("zoomCallback")) { - this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRange()); + this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRanges()); } }; @@ -2412,7 +2412,8 @@ Dygraph.prototype.parseCSV_ = function(data) { // Parse the x as a float or return null if it's not a number. var parseFloatOrNull = function(x) { var val = parseFloat(x); - return isNaN(val) ? null : val; + // isFinite() returns false for NaN and +/-Infinity. + return isFinite(val) ? val : null; }; var xParser; @@ -2644,6 +2645,11 @@ 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); }