[SOLVED] Invisible line in graph due to null data returned from influxdb query

Hello All,
I've working with influxdb to plot data from last few hour.
As i query for last 8 hour i'm getting "null" where missing values are.
below image shows value which are recorded into influx db generate line and null point not generating line inbetween.

Any idea how to ignore null point.
i need to keep X axis stable as possible

referance tutrial

Node red version 2.2.1: Maintenance Release
node-red-contrib-influxdb : 0.6.1
node-red-dashboard : 3.1.5

Another example of missing line


Post last value instead null

if(value == null)
        value = last_not_null_val
        last_not_null_val = value
    data += '{ "x":"' + thetime + '", "y":' + value + '}';

If you send last known not null value, you just increase the amount of data-points for chart to render.
Chart does the interpolation job without the extra data-point.
Just ignore null values

if(value != null){

    data += '{ "x":"' + thetime + '", "y":' + value + '}';
1 Like

Hi @hotNipi,
Thanks for input! :grinning:
Example code is generating json error while skiping null value.
I'm figuring out that part which will keep X axis intact as intented.

Actual reason is i've selected storage precision in influxdb to milisecond. turned it to second and probem gone.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.