Home › forums › Using CanvasJS › Having an onClick event on the entire chart
Tagged: event click
This topic contains 2 replies, has 2 voices, and was last updated by DaringDan 1 year ago.
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?
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.
That’s exactly what I needed. Thanks.
You must be logged in to reply to this topic.