In the project we have a custom onClick handler which runs several function related to fetching data from API regarding that particular data point in the chart. Each time a data point is clicked, all the functionalities work fine but I see this error in console.
I've searched online about this, but couldn't find a substantial solution to this.
Uncaught TypeError: Cannot read properties of undefined (reading 'handleEvent')
at Object.afterEvent (VM1134 requester-legacy.js:557376)
at callback (VM1134 requester-legacy.js:560145)
at PluginService._notify (VM1134 requester-legacy.js:554362)
at PluginService.notify (VM1134 requester-legacy.js:554349)
at Chart.notifyPlugins (VM1134 requester-legacy.js:555428)
at Chart._eventHandler (VM1134 requester-legacy.js:555452)
at listener (VM1134 requester-legacy.js:555333)
at Chart.event (VM1134 requester-legacy.js:552671)
at VM1134 requester-legacy.js:560084
afterEvent @ VM1134 requester-legacy.js:557376
callback @ VM1134 requester-legacy.js:560145
_notify @ VM1134 requester-legacy.js:554362
notify @ VM1134 requester-legacy.js:554349
notifyPlugins @ VM1134 requester-legacy.js:555428
_eventHandler @ VM1134 requester-legacy.js:555452
listener @ VM1134 requester-legacy.js:555333
event @ VM1134 requester-legacy.js:552671
(anonymous) @ VM1134 requester-legacy.js:560084
requestAnimationFrame (async)
nrWrapper @ team-apis:10
(anonymous) @ VM1134 requester-legacy.js:560082
nrWrapper @ team-apis:10
Example of the custom click handler:
const drilldownHandler = (datasetIndex, dataPointIndex, isValueZero) => {
setTileActive(report.id);
populateDrills(report.id, reportGroup, report.data.dataset[datasetIndex].values[dataPointIndex], isValueZero);
executeScroll();
return;
};
_.set(chartOptions, 'onClick', (eve, legendItem, legend) => {
if (!legendItem[0]) return;
const { datasetIndex, index } = legendItem[0];
const isValueZero = report.data.dataset[datasetIndex].values[index]['y'] === 0;
return drilldownHandler(datasetIndex, index, isValueZero);
});