Home forums Using CanvasJS Event handling on data click fails

This topic contains 3 replies, has 2 voices, and was last updated by  Manoj Mohan 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26925

    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.

    Here’s the working example I’m using – https://stackblitz.com/edit/test-function-binding

    Thanks,
    Sudha

    #26943

    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

    #26944

    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

    • This reply was modified 3 weeks, 1 day ago by  Sudha. Reason: Updated code link
    #26956

    Sudha,

    The issue seems to be with the context of “this” used in the onClick function. Please take a look at this updated sample.

    —-
    Manoj Mohan
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.