Skip to content

Commit

Permalink
Fixed stacking issue introduced in #83
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Apr 20, 2017
1 parent c545ae8 commit b865bf0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions chartkick.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,18 +569,22 @@

options.xAxis.categories = categories;

var newSeries = [];
var newSeries = [], d2;
for (i = 0; i < series.length; i++) {
d = [];
for (j = 0; j < categories.length; j++) {
d.push(rows[categories[j]][i] || 0);
}

newSeries.push({
d2 = {
name: series[i].name,
data: d,
stack: series[i].stack ? series[i].stack : null
});
data: d
}
if (series[i].stack) {
d2.stack = series[i].stack;
}

newSeries.push(d2);
}
options.series = newSeries;

Expand Down Expand Up @@ -1231,14 +1235,17 @@
var dataset = {
label: s.name,
data: rows2[i],
stack: s.stack ? s.stack : null,
fill: chartType === "area",
borderColor: color,
backgroundColor: backgroundColor,
pointBackgroundColor: color,
borderWidth: 2
};

if (s.stack) {
dataset.stack = s.stack;
}

if (chart.options.curve === false) {
dataset.lineTension = 0;
}
Expand Down

0 comments on commit b865bf0

Please sign in to comment.