Boolean to text mapping in Grafana

Viewed 11094

I have a single stat view that displays true or false based on the last value correctly from the data. However, I wish to map this to the text as follows:

  • false -> Radiator Off
  • true -> Radiator On

I've tried the values 0, 0.0, true and false in the value mappings and nothing seems to change what is on screen. If I have a null mapping and do something such as average the values this correctly displays the text. I've also listed my data in a table view and this shows 0.0 and 1.0 for the true/false states.

Does Grafana text mapping work with boolean values? There is nothing in the help that mentions anything about booleans.

1 Answers

I think because we're using Grafana to visualize time series data, therefore values should only in numeric or null.

Grafana don't have text mapping, I think you're referring Value Mappings.

You can convert boolean values from your query to numeric, such as true to 1 and false to 0, Value Mappings will work.

I've tried on https://play.grafana.org/ for mapping from 0 to Off and 1 to On, it worked well :D

Thanks for reading !!

enter image description here

Related