leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.51k stars 371 forks source link

Line disappears when there are relatively few datapoints #850

Closed newinnovations closed 11 months ago

newinnovations commented 11 months ago

This is related to my question #817.

I have a strange situation when I have few data points in relation to the wind data. When there is enough data things work ok:

image

When I zoom in and the wind data has much more data points than the main data, the line disappears:

image

Without the wind data the line shows fine:

image

Switch to dots instead of line also works:

image

Might this be a configuration issue?

leeoniya commented 11 months ago

what does your dataset look like? are you using uPlot.join()?

newinnovations commented 11 months ago

I combine the different data streams to have a common time base by inserting nulls. Then I give the data to uPlot:

const combined = combineSensorData(data, wind);
plot.setData(combined);

Dataset: [ [timestamps], [sensor-data], [wind-speed], [wind-dir] ]

combined.zip

leeoniya commented 11 months ago

you should insert undefined ;)

null is an explicit gap, whereas undefined is an alignment artifact. this is what uPlot.join() does, and my recommendation is to use that.