Value mapping with wildcards?

  • What Grafana version and what operating system are you using?
    9.1.6

  • What are you trying to achieve?
    I would like to assign colours to entries in a table based on their value.
    For example: “O.K.” in green colour, as shown. And other alarm entries in different colours.

  • How are you trying to achieve it?
    I try to use “Value Mapping”, but I think I cannot use wildcards here.
    For example, I would like to give every entry that starts with “Störung” the colour purple.
    But there are potentially endless variations of this entry, hence I cannot use value mapping for every entry.


    Is it possible to use wildcards here, like “Störung*” for every string starting with “Störung”?
    Or would I need to use the Regex feature? However, I do not want to replace one value with another, I just want to assign the colour based on the first characters of the string.

  • Did you follow any online instructions? If so, what is the URL?
    There is a brief description of Regex here Configure value mappings | Grafana documentation but the Regex syntax is not explained. Where can I find details on the usage of the Regex syntax, if Regex is the solution to my needs?

One last question, only partially related to this:

The colour of the table headers seems to be fixed to blue here, is there any chance to change the setting for each individual table?

Thank you very much in advance and best regards,
Falk

Hi,

I’m 90% sure that you can achieve that with Regex functionality in value mappings. You can add new mapping, choose Regex type, type Störung.* in the first field and just set the color. If you don’t fill the second filed, Grafana won’t change the value, it will just set the color.

As for the headers color - I don’t think you can change that. You (probably, maybe) could disable headers altogether and create headers via text panel but it doesn’t seem a good practice.

Edit: the Regex syntax is the normal (true, as my colleague once called it) regex, not Grafana-specific.

1 Like

Hi,

thanks a lot. It has worked, problem solved.

Thanks a lot for your assistance.

Cheers,
Falk

1 Like