Home forums Using CanvasJS Having an onClick event on the entire chart

Tagged: 

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23159

    DaringDan
    Member

    I have a small problem/query with CanvasJS.

    In my website, I am showing a video and a chart that contains relevant information concerning that same video. I would like to be able to click on the chart and seek to my video. To do that, I only need the X value (time in ms) of the click event to do the rest. Currently, I am showing about 10 area datasets with a shared tooltip that shows me the time as well.

    1) Do you think it’s possible to make a click event on the chart look into the tooltip and get the time from it?
    2) If not, what are my best options?

    #23174

    Vishwas R
    Keymaster

    @daringdan,

    If the length of video (in seconds / milliseconds) matches with the range of axisX (in seconds / milliseconds), you can seek video based on clicked position – with the help of convertPixelToValue method. Please take a look at this JSFiddle.


    Vishwas R
    Team CanvasJS

    #23178

    DaringDan
    Member

    That’s exactly what I needed. Thanks.

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

You must be logged in to reply to this topic.