From: Jason John Sayers Date: Tue, 30 Sep 2014 14:00:23 +0000 (-0500) Subject: Changed code to separate graph stacking logic by axis. X-Git-Tag: v1.1.0~38^2~1^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8b5f1691dd3745a9008bf8745a06239d04fb0b69;p=dygraphs.git Changed code to separate graph stacking logic by axis. --- diff --git a/dygraph.js b/dygraph.js index 8a1d65d..1aa43ea 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2499,6 +2499,7 @@ Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) { var extremes = {}; // series name -> [low, high] var seriesIdx, sampleIdx; var firstIdx, lastIdx; + var axisIdx; // Loop over the fields (series). Go from the last to the first, // because if they're stacked that's how we accumulate the values. @@ -2569,7 +2570,11 @@ Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) { seriesName, boundaryIds[seriesIdx-1][0]); if (this.getBooleanOption("stackedGraph")) { - Dygraph.stackPoints_(seriesPoints, cumulativeYval, seriesExtremes, + axisIdx = this.attributes_.axisForSeries(seriesName); + if (cumulativeYval[axisIdx] === undefined) { + cumulativeYval[axisIdx] = []; + } + Dygraph.stackPoints_(seriesPoints, cumulativeYval[axisIdx], seriesExtremes, this.getBooleanOption("stackedGraphNaNFill")); }