Series changes on rerender

Whenever my charts re-rerender, the series numbers are recalculated internally and any customized colors associated with the series change. So on a stacked bar chart, series one which I’ve mapped as green and series 2 mapped as red, swap colors. Or even worse, if a third series shows up, I get yet another color. How can I control series mapping to prevent this. Otherwise its worthless to my customers as a dashboard.

Hi @Richard_Williams -

You are correct that currently Charts picks colours for series using a “first come, first serve” approach. We don’t yet have a way of assigning specific colours to specific series, although that is something we plan to add. You may want to suggest this on for others to vote on.

In the meantime, while not a perfect solution, you improve the predictability of series ordering by adding a $sort stage using your series field in the query bar. That way, the documents will always be returned to the chart with the series in the same order, although if any expected series are not present then the colours could still change.


1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.