Way to adjust line colors for variables being plotted?

Hi, I have a templated dashboard that has a dropdown menu for selecting specific things to be represented on a graph. On these graphs, there is a sql metric that always returns 3 values, depending on the template variable selected. I’m wondering if there is a way of color coding these three variables to always be a specific color. The way it is now, I can adjust the color for one variable but then it creates a series specific override rather than adjusting the color for every variable for that parameter that is being returned. Am I missing something?

Not sure I understand - can you show more of your query and the series override? Are aware you can use regex for series overrides to try and match on multiple series?

I have a drop down selectable variable like below:
image

Which I have an SQL query returning these parameters.
image

I can click the little color icon to the left of the name to select a color but it only applies to that battery. I want to change the color of the first second and third measurements for the graph entirely so it doesn’t matter what battery variable someone selects.

I don’t want to user a series override but when I change the color for something via the legend it creates an override for just that specific battery measurement.

I’m not sure how the reges overrides work though, perhaps that may be of some use? If the measurement names are slightly different could I match on the different values, if it’s consistent, to create a color change override?

My code is below:

select $__time(cdtb.recorddate),
       cdtb.a As '1',
       cdtb.b As '2',
       cdtb.c As '3'
       from CompletionDailyTb cdtb
          inner join CompletionTb c
       on cdtb.ID = c.ID
          where c.Name like '$Name'
          and $__timeFilter((cdtb.recorddate+1)  + cdtb.recorddate)

Anyone know? Or is this not a possibility.

Sounds like you want a series override to me and it looks like the column alias is always the same, either 1, 2 or 3. Not seeing your problem. Why not just create one series override setting 1 to blue and another setting 3 to red (or whichever color you want).

If the column names can vary then I can do a regex like this to match the value 1 or the letter A:

/1|A/

I didn’t see any notes about how to use the regex series override in the documentation but that worked perfectly for what I needed! Thanks

1 Like

There are some tips here on series/style overrides:

https://community.grafana.com/t/advanced-graphing-part1-style-overrides/207

Thank you for this! I checked it out and was able to learn some new things!