How to to make Grafana not showing '0' values in graph?

Hello,
I’m having a seemingly simple problem, but I can’t find a solution yet. I receive data from a PMU which regularly seems to malfunction; by sending series of frequency values ​​at ‘0’ over a short period of time; then outputs correct values ​​again on a short period and so on. In Grafana, this translates into a stepped curve that overwrites the view on the time periods where the frequency is correct; making it unreadable.
image
I delved into Grafana’s options so that the graph does not take into account the null values ​​returned by the series to determine the ordinate autoscale; without success (whether at the level of the options of the ‘Time Series’ plugin or the ‘Transform’ options in the query editor).

The goal is that no value is displayed when the returned frequency value is either absent or zero; so that the display of the graph on the time ranges where the data is present remains in a range of ordinates making it possible to easily visualize the fluctuations (for example [49.8-50.2] for a frequency at 50 Hz :

Does someone know the parameter to adjust or the way to make it working like that ?

Regards,

Stephane.

Try ExcludeRange(0, 0, expression)

Hello Ritchie,

Thank you for the quick reply.
The suggestion almost did what I wanted to achieve: ‘0’ values ​​are no longer displayed on the graph and the autoscale of the ordinates remains in a correct range. However the remaining plots are joined by the curve whereas I would prefer to have a broken line when encountering missing/exclude data ; but it does not matter: this result is also very good.

Topic closed

Thank you !

Regards

Haven’t tried this personally, but found this info on Grafana settings:

  • Null value – Specify how null values are displayed:
    • connected – If there is a gap in the series, meaning one or more null values, the line will skip the gap and connect to the next non-null value.
    • null If there is a gap in the series, meaning a null value, the line in the graph will be broken and show the gap. This is the default setting.
    • null as zero – If there is a gap in the series, meaning a null value, it will be displayed as a zero value in the graph panel.

Thank you for the additional informations.
Excluding the ‘0’ values effectively exclude them for the data grabbed by the query. I’ve managed to obtain the same results as the ExcludeRange() function by using the following ‘Transform’ option in Grafana :
image
But I prefer the use of ExcludeRange() directly in the body of the query because it allows the use of variables ($PMU_NAME) while going through ‘Transform’ requires specifying in the object of the transformation the real name of the PMU (and loose the benefit of using variables because I can’t specify a variable name in the ‘Field’ field).
My last tests did not allow me to find how to substitute the ‘0’ values ​​of the series with the ‘Null’ value which I think is the only way currently in Grafana to obtain the expected result (the discontinuity of the display). But the result obtained following your advice suits me well because it prevents the autoscale from imposing a range of ordinates [0-50] on me; which was the intended goal.

Regards