Home Forums Chart Support Error when i run with condition and without condition run fine Reply To: Error when i run with condition and without condition run fine

#38154

@friday096,

You can use useRef hook for getting the chart object reference as shown in the code snippet below.

<CanvasJSChart
        options={options}
        onRef={(ref) => {
          chartRef.current = ref;
        }}
/>

Also, check out this StackBlitz project for an example on the same.

If you are still facing the issue, kindly create a sample project reproducing the issue and share it with us over Google-Drive or Onedrive so that we can understand your scenario better and help you out.

—-
Manoj Mohan
Team CanvasJS