# Way to adjust line colors for variables being plotted?

**URL:** <https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053>\
**Category:** Time Series Panel\
**Created:** [March 6, 2019, 2:02pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053 "2019-03-06T14:02:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![damienclark](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@damienclark](https://community.grafana.com/u/damienclark)\
**Post date:** [March 6, 2019, 2:02pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/1 "2019-03-06T14:02:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [March 7, 2019, 9:36am UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/2 "2019-03-07T09:36:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![damienclark](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@damienclark](https://community.grafana.com/u/damienclark)\
**Post date:** [March 7, 2019, 1:38pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/3 "2019-03-07T13:38:54Z")

</div>

I have a drop down selectable variable like below:  
 ![image](https://us1.discourse-cdn.com/grafana/original/2X/a/ad1476b672228536288ced2c8cfee36be87f53b3.png)

Which I have an SQL query returning these parameters.  
 ![image](https://us1.discourse-cdn.com/grafana/original/2X/4/470c56334d19c0a4f52f4514b5ea595d27e420f2.png)

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)

```

---

<div class="post-metadata">

**Author:** ![damienclark](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@damienclark](https://community.grafana.com/u/damienclark)\
**Post date:** [March 12, 2019, 1:33pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/4 "2019-03-12T13:33:23Z")

</div>

Anyone know? Or is this not a possibility.

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [March 13, 2019, 1:27pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/5 "2019-03-13T13:27:21Z")

</div>

> [@damienclark](#):
>
> I don’t want to user a series override

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/`

---

<div class="post-metadata">

**Author:** ![damienclark](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@damienclark](https://community.grafana.com/u/damienclark)\
**Post date:** [March 18, 2019, 7:54pm UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/6 "2019-03-18T19:54:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [March 19, 2019, 8:53am UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/7 "2019-03-19T08:53:05Z")

</div>

There are some tips here on series/style overrides:

[https://community.grafana.com/t/advanced-graphing-part1-style-overrides/207](https://community.grafana.com/t/advanced-graphing-part1-style-overrides/207)

---

<div class="post-metadata">

**Author:** ![damienclark](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@damienclark](https://community.grafana.com/u/damienclark)\
**Post date:** [March 28, 2019, 3:39am UTC](https://community.grafana.com/t/way-to-adjust-line-colors-for-variables-being-plotted/15053/8 "2019-03-28T03:39:33Z")

</div>

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