Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
How to stop/remove this error for custom onClicks function in chart.js version 3.3.0?

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);
      });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!