Decimation won't work when passing my own array.
See original GitHub issueI’ve been having issues trying to get decimation to work and for a long time and I thought that my config was wrong. At some point I decided to take a look at the docs again and set all necessary options as described in the requirements, and also providing a prepared data with parsing
set to false
. I still couldn’t get decimation to work.
I tried to make a very basic chart implementation in a simple HTML file in order to eliminate the possibility that something in my app is causing the trouble and I still get the same result. Today I tried the exact same example file but instead of using my test dataset, I copied the code from the official decimation example which dynamically generates the dataset from a single timestamp. Surprisingly for me - it worked. If I use the code from the example, decimation works, but as soon as I pass my own data array - it doesn’t work.
For more information - I use a linear time scale with timestamps for the x axis. I use the date-fns adapter and for a long time I have been thinking that my problem was either in the date adapter or the zoom plugin. But as it turned out - both plugins are fine and don’t break decimation at all.
So my question is - what is going on? My suspicion is in the last requirement for decimation - The dataset object must be mutable
. If that’s the case, can someone explain what I’m doing wrong? I thought that objects and arrays in JavaScript are mutable, even if they are defined as constants. I tried using let
and var
but the result was still the same.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
#9327 will allow configuring that
Alright, so having in mind that in my case I don’t have enough points for decimation and https://github.com/chartjs/Chart.js/pull/9327 will allow us to chose a specific treshold, I will close this issue.