Harmonized colors for same series in multiple pie charts

Hello!

I have two pie charts in Grafana v8. Both depict statistics of the same series, that means the legend entries are the same in both charts. The amount of series is dynamic based on the used data source.

Goal: s1 in chart1 shall have the same color like the s1 in chart2. s2 in chart1 shall have the same color like the s2 in chart2, and so on.

How can this be configured?

As the amount of series is dynamic (s1…sn), it is not possible to configure it manually for each series.

Any feedback is appreciated!

Hi @hafeja

I would try using Field Overrides:

See if you can set a field override per series name. this should allow you to create much more detailed panel customizations.

Hello @mattabrams , thanks for your feedback.

How can “Field overrides” be used to define colours dynamically (the amount of cake pieces varies) across multiple pie charts?

Defining a color for a particular series in each panel individually should be straight-forward. However, that approach doesn’t answer the actual question.

Hi @hafeja!
Same problem here:
We have

  • a number of teams,
  • error types 1 to 5,
  • and several projects.

Each project has its own dashboard. In each dashboard we have 5 pie charts for the 5 error types. These pie charts shall reflect which team has how many errors (in absolute numbers and as a percentage) per error type.
The problem is that new teams might be created along the way and there will be more and more projects (and therefore dashboards) in future. So manually adding the same color overrides to all pie charts for all dashboards would result in a lot of maintenance effort for each new team.
Even though I absolutely see the need to be able to assign fixed colors to certain elements and use these colors across multiple pie charts, I doubt that there’s an easy fix for this in Grafana itself. Someone prove me wrong, please!
One idea would be to keep the mapping of teams and colors in a database and use a script to parse the JSON source code and add all the color overrides, but of course only to those pie charts for which this is required. They would need to be identified by the script somehow so that other pie charts won’t be affected. Whenever a new team is added the script would need to be run manually for all dashboards and the new overrides would get inserted in the JSON code.
I have no idea, however, whether this will be feasible in the end and how much effort this would be …

hmmm…I don’t think anything exists in the UI to modify behavior quite like that (if I’m understanding correctly, and overrides are not sufficient)…