Skip to content

Commit

Permalink
fixup! fix pie chart multiple colors changed (re getredash#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short committed Dec 15, 2017
1 parent 2f9fcc7 commit 748f834
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions client/app/visualizations/chart/plotly.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const PlotlyChart = () => {
labels: [],
type: 'pie',
hole: 0.4,
marker: { colors: ColorPaletteArray },
marker: { colors: ColorPaletteArray.slice() },
text: series.name,
textposition: 'inside',
name: series.name,
Expand All @@ -279,15 +279,11 @@ const PlotlyChart = () => {
},
};

series.data.forEach((row) => {
each(series.data, (row, rowIdx) => {
plotlySeries.values.push(row.y);
plotlySeries.labels.push(hasX ? row.x.toString().substr(0, xAxisLabelLength) : `Slice ${index}`);
if (scope.options.seriesOptions[hasX ? row.x.toString().substr(0, xAxisLabelLength) : `Slice ${index}`] === undefined) {
plotlySeries.marker.colors.push(getColor(index));
index += 1;
} else {
plotlySeries.marker.colors.push(scope.options.seriesOptions[hasX ? row.x.toString().substr(0, xAxisLabelLength) : `Slice ${index}`].color);
}
const rowOpts = scope.options.seriesOptions[hasX ? row.x.toString().substr(0, xAxisLabelLength) : `Slice ${index}`];
plotlySeries.marker.colors[rowIdx] = rowOpts ? rowOpts.color : getColor(rowIdx);
});

scope.data.push(plotlySeries);
Expand Down

0 comments on commit 748f834

Please sign in to comment.