reactchartjs / react-chartjs-2

React components for Chart.js, the most popular charting library
https://react-chartjs-2.js.org
MIT License
6.64k stars 2.37k forks source link

[Bug]: Line disappears when calling zoomScale() multiple times #1185

Open bjorn-bakken opened 1 year ago

bjorn-bakken commented 1 year ago

Would you like to work on a fix?

Current and expected behavior

I have a simple line chart with type of x scale set to time and two buttons to set zoom to one and two weeks respectivly for the x-axis.

When zoomScale(...) is called multiple times, some line segments disappears (but the markers are still there). If data are more well behaved (ie. not flucuating to much) I don¨t get the same problem.

Illustrated in gif below.

charjs_zoom

Reproduction

https://codesandbox.io/p/sandbox/magical-driscoll-l3jzzw?file=%2Fpackage.json%3A1%2C1

chart.js version

v4.3.2

react-chartjs-2 version

5.2.0

Possible solution

The bug (if that is what it is) might well be in chart.js or chartjs-plugin-zoom. I will create a related issue with them also.

tomas1646 commented 1 year ago

Same here.

I've downgraded chart.js version to 4.3.0, and it's working correctly on that version.

bjorn-bakken commented 1 year ago

I can confirm that downgrading chart.js to 4.3.0 fixes the issue for me to. Thank you @tomas1646!

StefanNedelchev commented 1 year ago

I confirm the same behavior too. I downgraded to 4.3.0 as a temporary solution