Home forums Using CanvasJS onclick parameters

This topic contains 1 reply, has 2 voices, and was last updated by  Sunil Urs 3 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4237

    wdthiago
    Participant

    Hi there,
    First of all congratulations on this amazing library, I’ve been using it on all my personal projects and I just can’t get enough of it!
    Second I would like to know what parameters I have access in the onclick function in a Data Point? Is it only the x and y values? Can I get somehow the label value for the Data Point to pass as parameter to a JS function?
    Thanks!

    #4238

    Sunil Urs
    Keymaster

    Thank you.. 🙂

    You can access all properties of dataPoint/dataSeries including label. Upon any mouse event you get dataSeries and dataPoint inside the parameter e – which is passed to the event handler function. Once you have the handle to dataPoint, you can access all the properties inside dataPoint

    ex: e.dataPoint.label

    Checkout the documentation below

    http://canvasjs.com/docs/charts/basics-of-creating-html5-chart/event-handling/

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

You must be logged in to reply to this topic.