TEflow
Posts: 2
Joined: Wed Jul 14, 2021 10:03 am

Plot line on a point

Hi,

I have a use case where I have a point I would like to highlight with a horizontal line as it's Y value. The idea being a viewer can see which portion of the rest of the data falls above or below this point.

I can't just use a plot line because the x value of the point is important.

So far I have tried using a series and a seperate plot line to achieve this. However this means if the user deselects the series from the legend it will hide the point but not the plotline itself.

I was wondering if there is a better way of doing this?

Many Thanks
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Plot line on a point

hi! Welcome to the official highcharts forum, and thanks for contacting us with your question! What you described seems to be suited job for annotation module. Check the following article, where it is exactly described how to use the annotation, and let me know, if that works for you! Kind regards,

https://www.highcharts.com/blog/tutoria ... ns-part-1/
Paweł Lysy
Highcharts Developer
TEflow
Posts: 2
Joined: Wed Jul 14, 2021 10:03 am

Re: Plot line on a point

Thanks for the response, I think this should cover what I need by using a path shape tied to the id of the point.
When defining the points for the shape is there an easy way to get a line that covers the x-axis?
Or do I need to do something like this
points: [{x:'minimum x value on chart ',y:'y value of the point',},'id of the point',{'maximum x value on the chart', 'y value of the point'}],



Kind regards,
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Plot line on a point

What do. you mean by line, that covers xAxis? You want the line to be vertical/horizontal? Please elaborate. Apart from that, everything is in the api: https://api.highcharts.com/highcharts/annotations

You can check the example configuration of the line here: https://jsfiddle.net/BlackLabel/369t5qmu/

Let me know if that works for you! Kind regards,
Paweł Lysy
Highcharts Developer

Return to “Highcharts Stock”