From: eichsjul Date: Fri, 12 Apr 2013 06:50:58 +0000 (+0200) Subject: BUGFIX #451: fixed "connect-separated-points" bug X-Git-Tag: v1.0.0~31^2~10 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=14ac984ed878febd5e2831386b22c2548bfdb73b;p=dygraphs.git BUGFIX #451: fixed "connect-separated-points" bug --- diff --git a/dygraph.js b/dygraph.js index 0dcc23a..afa3fd0 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2313,13 +2313,30 @@ Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) { } } if (firstIdx === null) firstIdx = 0; - if (firstIdx > 0) firstIdx--; + var correctedFirstIdx = firstIdx; + if (correctedFirstIdx > 0) correctedFirstIdx--; + while(series[correctedFirstIdx][1] === null && correctedFirstIdx > 0){ + correctedFirstIdx--; + } + + if (lastIdx === null) lastIdx = series.length - 1; - if (lastIdx < series.length - 1) lastIdx++; - boundaryIds[i-1] = [firstIdx, lastIdx]; + var correctedLastIdx = lastIdx; + if (correctedLastIdx < series.length - 1) correctedLastIdx++; + while(series[correctedLastIdx][1] === null && correctedLastIdx < series.length - 1){ + correctedLastIdx++; + } + + boundaryIds[i-1] = [(firstIdx > 0) ? firstIdx - 1 : firstIdx, (lastIdx < series.length - 1) ? lastIdx + 1 : lastIdx]; + + if(correctedFirstIdx!==firstIdx) + pruned.push(series[correctedFirstIdx]); for (k = firstIdx; k <= lastIdx; k++) { - pruned.push(series[k]); + pruned.push(series[k]); } + if(correctedLastIdx !== lastIdx) + pruned.push(series[correctedLastIdx]); + series = pruned; } else { boundaryIds[i-1] = [0, series.length-1];