Singlestat null color colour

Hello, I’m new to grafana (running 4.1.1) and I am trying to figure out how to get the singlestat panel to display a specific colour / color when there is null data.

The panel displays an averaged time for the last 15 minutes of data but the data is intermittent so I might have 10 updates in the space of five minutes (which is then averaged) or I might not have any updates for 30 minutes (at which point the average is null).

What I want is when an average can be calculated is the panel to be green and showing the averaged value and when there is no data to average I want the panel to be red. While I can just set the value mappings of null to either blank / #N/A / *NO DATA* I have quite a few panels so I want a easy colour / color coded system that allows for easy visual inspection.

I cannot use changed() as I want to see the averaged values in the panel and I cannot use transformNull() either as this skews the average. I could potentially use transformNull() if I could create a query that has only a single averaged value but I have not been able to figure out how to get this to work.

I don’t know of any way to get a null color in the Singlestat panel. The hacky not very accurate way would be to map it to a value (0 or -1) and then use thresholds to control the color.

I tried that but mapping null to a value does not appear to work…rather than treating the mapping as a value e.g., null = -1 it appears to treat it as string and ignore it

1 Like

See here: SingleStat color issue for null mapped to "0"