Skip to content

Commit

Permalink
Fix single-column pivot issue
Browse files Browse the repository at this point in the history
When only one field is set as pivot column, the x-axis labels were doubled.
This is now fixed.
  • Loading branch information
ksokolovic committed Jun 8, 2019
1 parent ef43952 commit 9b9b0f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pivots.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ function pivotBarChart() {
let group = pivot.columns[i];
xLabels.push(repeatArray(unique[group], xLabels[i - 1].length));
}
xLabels.push(repeatArray(unique[pivot.columns[pivot.columns.length - 1]], data.length / unique[pivot.columns[pivot.columns.length - 1]].length / yLabels.length));

if (pivot.columns.length > 1) {
xLabels.push(repeatArray(unique[pivot.columns[pivot.columns.length - 1]], data.length / unique[pivot.columns[pivot.columns.length - 1]].length / yLabels.length));
}

return xLabels;
}
Expand Down

0 comments on commit 9b9b0f7

Please sign in to comment.