chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.69k stars 11.92k forks source link

Decimation docs missing requirement #10514

Closed MaxboDev closed 2 years ago

MaxboDev commented 2 years ago

Documentation Is:

Please Explain in Detail...

After experimentation I found that decimation only works if the number of points on the chart is 4+ times the pixel width of the chart. You can see it here: https://codesandbox.io/s/react-17-forked-gt7qvw?file=/src/App.js. Resize the preview area and you'll see decimation kick in at widths below 500px.

This requirement isn't documented in list here: https://www.chartjs.org/docs/latest/configuration/decimation.html#requirements

I'm also not sure why this is a requirement. It makes sense for min-max decimation but when using lttb it doesn't seem necessary.

Your Proposal for Changes

It seems like this requirement should be documented here. Will create a PR for it.

Example

https://codesandbox.io/s/react-17-forked-gt7qvw?file=/src/App.js

etimberg commented 2 years ago

Writing some documentation is good. The 4*width is just the default. If you set the threshold option of the plugin, it will use that instead.

MaxboDev commented 2 years ago

Ah thanks, I missed that. Have created a PR to mention that in the decimation requirements here https://github.com/chartjs/Chart.js/pull/10516