Skip to content

Commit

Permalink
reset the stack index at the end of every stack
Browse files Browse the repository at this point in the history
otherwise the stack offsets don't reset properly
  • Loading branch information
w33ble committed Jun 5, 2015
1 parent 0325408 commit 43c6e30
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ define(function (require) {
}

PointSeriesChart.prototype._stackMixedValues = function (stackCount) {
var currentStackOffsets = [];
var currentStackOffsets = [0, 0];
var currentStackIndex = 0;

return function (d, y0, y) {
if (currentStackIndex++ % stackCount === 0) {
var firstStack = currentStackIndex % stackCount === 0;
var lastStack = ++currentStackIndex === stackCount;

// if the current stack index has reached the final stack, reset the stack count
if (firstStack) {
currentStackOffsets = [0, 0];
}

if (lastStack) currentStackIndex = 0;

if (y >= 0) {
d.y0 = currentStackOffsets[1];
currentStackOffsets[1] += y;
Expand Down

0 comments on commit 43c6e30

Please sign in to comment.