How do I add crosshairs to a Line chart?


Posted by Lorri at 18:24 on Thursday 31st December 2020 [link]
I have a Line chart that I'd like to add crosshairs when the user clicks or hovers over a point.

Thanks.

Posted by Richard at 18:37 on Thursday 31st December 2020 [link]
The easiest way is to just use the crosshairs* properties. With the Line chart it only works with the mousemove event.

I've made you an example and it's here:

https://codepen.io/rgraph/pen/LYRdbwJ

NOTE:

Initially I said that you had to use the Scatter chart for this - but that is only if you wish to get an X/Y coordinate pair (since the Scatter chart has an X axis scale). This example shows a Line chart with crosshairs.

[Replies are now closed]