Open twilson90 opened 1 month ago
Figured out a solution, when appending samples with decimation enabled I now do:
dataset.data.push(...samples);
if (dataset._data) dataset._data.push(...samples);
And if I'm retrieving a sample from a dataset, I refer to _data if it exists, otherwise data.
Thanks for reporting this @twilson90. It definitely sounds like a bug in the decimation plugin since you shouldn't need to care about _data
.
Expected behavior
I have a line chart that updates every second with live data. Every time data is received it is pushed onto a
dataset.data
. (not re-constructed) I have enabled decimation and zoom because the amount of data points can get into tens of thousands. All works well until I zoom out enough that the decimation threshold is passed, at which point the graph stops adding points to the canvas. The scale continues to grow however which suggests a bug. If I disable decimation then the problem doesn't occur.Presumably I have to do something to refresh the internal _data buffer but there's nothing in the docs I can find that suggests anything.
Current behavior
What it looks like after zooming out and waiting:
Closer to what it should look like:
Optional extra steps/info to reproduce
Whenever I want to add data:
Possible solution
Some way of refreshing decimate's
_data
buffer referenced in the docs?Has to be efficient though, can't regenerate from scratch with each new sample.
Context
No response
chart.js version
4.4.4
Browser name and version
No response
Link to your project
No response