You must be logged in to post your query.
Home › Forums › Chart Support › Event handling on data click fails
Hi,
I’m able to get details from data points via event handling when I have static data. If I use the same way to get details with data called from service(Angular), I’m getting the following error – Error: g[e[f]].call is not a function.
Error: g[e[f]].call is not a function
Here’s the working example I’m using – https://stackblitz.com/edit/test-function-binding
Thanks, Sudha
Sudha,
The issue seems to be with the binding of click-event handler. onClick that’s being assigned to click event in sample.data.ts file is undefined. Please take a look at this updated sample.
—- Manoj Mohan Team CanvasJS
Hi Manoj,
Thank you so much. It’s working now.
Also, I have one more doubt. The data that we are fetching in event handling function is not getting reflected in UI though it’s getting updated in console. Is this related to Canvas or some issue with Angular? I have updated the code
Regards, Sudha
The issue seems to be with the context of “this” used in the onClick function. Please take a look at this updated sample.
This worked. Is there a way to pass the value of i from for loop to onClick function along with e value?
Please ignore my last message.. I was able to achieve what I wanted, by accessing e.dataPointIndex.
Glad that you figured it out :)
You must be logged in to reply to this topic. Login/Register