X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=e28c273bac2342397736ed803c2fa1b9399d4d86;hb=5f3b823b04c883763db7532e131f81e79f032f96;hp=bd89a90b5d9fe9cb741de7ee019d493b70fbb3d3;hpb=8d4465c486438c54fe424bf415d6852635572eb4;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index bd89a90..e28c273 100644 --- a/dygraph.js +++ b/dygraph.js @@ -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); }