The issue occurs after upgrade chart.js to 3.0-beta.11.
As I debugged, I located the issue is that a pull merged in 3.0-beta.11 chartjs/Chart.js#8374. This pull makes options gets updated depending on prev status data (old data)
An obvious bug in my case is that options with multiple y-axes toggling functionality failure.
Because old data(datasets) say toggling single axis( y ) to y-axes( y1, y2, ... ) had been assigned to y, net yet assigned to y1, y2, ..., but updating options depends on data (old data)
The problem code lies as below
|
chartInstance.current.options = options; |
|
chartInstance.current.data = data; |
We just need to switch these two lines will fix this issue
// $HOME/src/ReactChart.tsx
// other stuff...
useEffect(() => {
chartInstance.current.data = data;
chartInstance.current.options = options;
chartInstance.current.update(updateMode);
}, [data, options]);
// other stuff...
The issue occurs after upgrade chart.js to
3.0-beta.11.As I debugged, I located the issue is that a pull merged in
3.0-beta.11chartjs/Chart.js#8374. This pull makesoptionsgets updated depending onprev statusdata(old data)An obvious bug in my case is that
optionswith multiple y-axes toggling functionality failure.Because old data(datasets) say toggling single axis(
y) to y-axes(y1, y2, ...) had been assigned toy, net yet assigned toy1, y2, ..., but updatingoptionsdepends ondata(old data)The problem code lies as below
chartjs-react/src/ReactChart.tsx
Lines 39 to 40 in 2a457b2
We just need to switch these two lines will fix this issue