From 14ac984ed878febd5e2831386b22c2548bfdb73b Mon Sep 17 00:00:00 2001 From: eichsjul Date: Fri, 12 Apr 2013 08:50:58 +0200 Subject: [PATCH] BUGFIX #451: fixed "connect-separated-points" bug --- dygraph.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) 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]; -- 2.7.4