2👍
You can’t use the global chart instance, you need to use your chart instance to call the function like so:
const chartInstance = Chart.getChart(canvasId);
const points = chartInstance.getElementsAtEventForMode("click", 'nearest', { intersect: true }, true);
- [Chartjs]-How can I use an array of {x,y} objects to make a chart?
- [Chartjs]-Chart.js – Creating multiple charts on one page
0👍
In Chartjs, it has getElementsAtEventForMode not eventsForMode..
use
Chart.getElementsAtEventForMode
instead of
Chart.getElementsAtEventsForMode
Source:stackexchange.com