question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decimation won't work when passing my own array.

See original GitHub issue

I’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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kurklecommented, Jul 3, 2021

#9327 will allow configuring that

0reactions
hardmaster92commented, Jul 4, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Array Decimation - Stack Overflow
The problem is, i should keep the characteristic of the array during the decimation. When i tried to calculate the arithmetic mean the...
Read more >
Solved: Bug in Decimate 1D Array - NI Community
The Decimate function that is fed the smaller array retuns Zero as the first element, which is incorrect. The first element is not...
Read more >
Decimating with out losing Min's and Max's - LAVA
I've tried creating my own version of code to decimate and capture peaks and valleys. It work well but is slow. Is there...
Read more >
Array is not preserved after decimation filter #211 - GitHub
The array cannot be maintained/passed through the decimate filter as the topology of the mesh is dramatically altered in this filter.
Read more >
Selecting the Low Pass FIR Filter, Decimation, DSP
When you are decimating a signal x(n), to x(an) (a>1),in the frequency domain the spectrum expands. This might lead to aliasing of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found