Arun Muthupalaniappan
Arun Muthupalaniappan

Reputation: 170

How to set Display name in Grafana for a time series line using dashboard variables?

I currently have a dashboard variable dimensionValue defined in my variables, in my dashboard. This query for this variable equates to 2 possible values : ORDS or APEX. I would like to label the lines on a time series graph based on these variables. I tried using $dimensionValue in the Display name (Change the field or series name) field, however this ends up showing both the values in the graph legend. The green represents the first value 'APEX', and the yellow represents the second value 'ORDS'. I just want them to have their respective names instead of the whole tuple. Dashboard Screenshot

Upvotes: 0

Views: 9917

Answers (2)

Arun Muthupalaniappan
Arun Muthupalaniappan

Reputation: 170

I was able to do this : Use transforms to find and replace by regex. This works in Grafana 8.5.27.

Transform display name by regex in Grafana

Upvotes: 0

markalex
markalex

Reputation: 13341

It seems you are missing what Display name options does. It can have a dynamic results, but only based on field of your actual data set. And it cannot simply match arbitrary list of values with series.

Depending on data source in use you might have an option set a legend in query option. Or you can apply name through some logic over __field variable, but generally what you described in question is not possible.

Upvotes: 1

Related Questions