Synchronizing multiple (Canvas) on a page using CanvasJS

40 views Asked by At

I'm working on a React application that uses the CanvasJS library to display multiple line charts. I have two or more charts on the same page, and I want to implement synchronization for zooming and panning between these charts. When a user zooms or pans in one chart, the others should follow the same changes.

I've created separate React components for each chart and added a function in the parent component. However, it's not working.

https://stackblitz.com/edit/canvasjs-react-sync-zooming-panning-multiple-char-ev689u?file=src%2FApp.js,src%2FChart.js

1

There are 1 answers

0
ssss On

I was able to fix it by pushing the refs https://stackblitz.com/edit/canvasjs-react-sync-zooming-panning-multiple-char-ev689u?file=src%2FApp.js,src%2FChart.js

I also noticed that React.strictMode was causing an issue