From: Wim Bruynooghe Date: Fri, 31 May 2013 11:22:44 +0000 (+0200) Subject: LogScale and customBars with negative values X-Git-Tag: v1.0.0~25^2~4 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=5d0b01e9c4c738cbec62dca085e15ceff0a99082;p=dygraphs.git LogScale and customBars with negative values When LogScale and customBars are enabled, it was verifying if the value was negative by using a <= on an array and then inserting a null. This caused exceptions in rollingAverage(), the value can't be null when using customBars. (This a new patch based on the current code, since pull request #236 was getting old). --- diff --git a/dygraph.js b/dygraph.js index 5e4ba62..9f9dc26 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2821,12 +2821,20 @@ Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) { if (logScale) { // On the log scale, points less than zero do not exist. // This will create a gap in the chart. - if (point <= 0) { + if (errorBars || customBars) { + for (var k = 0; k < point.length; k++) { + if (point[k] <= 0) { + point = null; + break; + } + } + } + else if (point <= 0) { point = null; } } // Fix null points to fit the display type standard. - if(point !== null) { + if (point !== null) { series.push([x, point]); } else { series.push([x, errorBars ? [null, null] : customBars ? [null, null, null] : point]);