Home Forums Chart Support Click event on line in line chart

Click event on line in line chart

Viewing 3 posts - 1 through 3 (of 3 total)
  • #43637

    How can I fire event when clikcing on line (not dots on line) using line chart.

    Example – basic line chart. I want click on line (mart it with yellow arrow on image) and fire click event, where I want get all line data or index.

    line chart

    How can I do this?

    #43638

    how can I make click event when click on line (line chart) – not dots on line, but line itself?

    #43687

    @n-osenni,

    CanvasJS click event is fired only when you click on datapoint (marker) & not when you click on line as of now. However, with a few lines of code you can achieve to detect if the click has happened on the line. To do so, you can bind click event to the chart canvas & with the help of point on the line formula, you can determine whether the click happened on the line connecting two datapoints.

    Please take a look at this JSFiddle for a working example.

    Click event handler for dataseries line

    __
    Sachin Bisht
    Team CanvasJS

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

You must be logged in to reply to this topic.