How to tie graph colour to a variable


I’m using Graphana v5.2.3.

I’ve created a dashboard (for prometheus proc exporter) with two variables for which the user has to input values. The two variables are used separately in two different queries which display line-graphs on the same graph panel. The end-user can either input values for both variables or leave one of them empty.

I would like to ensure that $variable1 one shows graph lines always in Red and $variable2 always has graph lines in blue.

Currently this only works if both variables have values, but if $variable1 is empty then $variable2 graph-line gets the $variable1 color.

How can I fix this ?


Under the Display tab of editing the graph you can set a series override for the color of the series. You can either hardcode series name, or make a regex for it;

Thank you. That worked.

I had to change the “Legend Format” value to have a specific prefix-string for each series. Then in the Display tab I added two series overrides which had regxes containing the Legend Format prefix strings and colour fixed to what I wanted.

Thanks again for your prompt response.