@gaurav-sharma6,
To access ref attributes in react, you need to use stockChart.current.stockChart. Please take a look at this react documentation for more information.
Please take a look at this updated StackBlitz example.
—-
Manoj Mohan
Team CanvasJS