How to display '0' for series value when value is null?

We have a timeseries panel that is showing data from several categories (series). When one of the series is has no data available, i.e. is null, the tooltip snaps to the nearest value when hovering over the chart:

Rather than snapping to the nearest value for the null series, how can I configure the chart to either:

  • display ‘0’ for the series
  • omit the series from the tooltip?

Note: I have set the chart hover tooltip to show data from all series and treat null as zero:

Screenshot_20180418_134404

1 Like

I think this is dependent on your datasource. For a source like InfluxDB, you can tell it how you want to represent missing data.

If you were using InfluxDB, you could select 0 from this dropdown, and that would give you the exact result that you’re looking for. Not sure what datasource you’re using though. ¯\_(ツ)_/¯

We are using a PostgreSQL data source.

For illustration, there can be multiple series in a chart with gaps between values, or series that start after others:

Peek%202018-04-19%2010-23

Hi,

Starting from Grafana v5.1 you can use a new fill argument with the $__timeGroup macro function, see postgres v5.1 documentation.

If running nightly builds or building from source you should be able to use this new functionality right now.

Grafana v5.1 stable will be released in the upcoming weeks.

Marcus

Hello,

Not to hijack this thread (will start new if needed) but I’m having the same issue but with ElasticSearch. So when I display a time series using tooltips showing all series and some of those series are null for a portion of time it will errantly show the closest known value, not zero. To the user they see the vertical crosshair and I would expect logically that they would assume values displayed in tooltip are only for that time moment, not a hybrid collection of various closest values. Do you know if there a work around, fix or suggested use in this situation? Thanks,

John…

Verify your setting of the Null Value, see documentation. If that’s not helping you I would suggest to create a new topic.

Marcus

Ok I think I have a solution, or at least a work around. Initially I thought my problem was similar but pretty sure I’ve got a different situation. In my ES in docs I have one field that identifies a software version number. Every time period I will have thousands of docs with a single sw version identified. The time series graph is then of one series (not multiple) but showing the count of each unique version. Since more recent versions would not be available in the past they should show up as zero during those times. The work around was found within the query. If I selected a “Min Doc Count” of “0” in my “Date Histogram” section it all worked as expected. However, if I changed it to “1” I got the hybrid closest known values mix up. I usually like to keep it at “1” so if there are any missing data time periods it draws the graph more “cleanly” without dropouts. I can live without that for now, but the overall behavior still seems a little strange. If you think there is still something that needs to be fixed I can start another thread. Otherwise I’m ok with this solution for now. BTW, changing “Null Value” settings had no effect. Thx…