0π
the solution have been found
i genrally use any type in useRef so it can acquire any type of refrences
so the code becomes
const chartRef = useRef<any>(); //just use any type here and problem resolved
const onClick = (e:React.MouseEvent<HTMLCanvasElement, MouseEvent>) => {
console.log(getDatasetAtEvent(chartRef.current, e));
}
- Chartjs-How can i add additional Data(Type) to chart.js
- Chartjs-Cannot read properties of undefined (reading 'notifyPlugins') β chart.js
Source:stackexchange.com