Vimaire
Posts: 2
Joined: Thu Oct 14, 2021 2:01 pm

Modify value of a specifi plotLine

Hey,

I got a graph with multiple plotlines representings various stats, and I would like to update just the value of theses lines, but I can't find a way to do it, only way i found was removing them, and adding them with the new value right after, but I'm sure there is a workaround, could someone help me on that ?

Thanks in advance,

Regards,
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Modify value of a specifi plotLine

Hi,

Welcome to our forum and thanks for contacting us with your question!

You can update plot lines values without removing them using update() function. Here is a simple demo showing how to implement this:

Demo
https://jsfiddle.net/BlackLabel/1jhodekx/

Feel free to ask any further questions!
Regards!
Magdalena Gut
Developer and Highcharts Support Engineer
Vimaire
Posts: 2
Joined: Thu Oct 14, 2021 2:01 pm

Re: Modify value of a specifi plotLine

Thanks a lot for your answer, but I was wondering if I could update the value using the id of the plotline, because the [0] element of the plotlines array might not always be the same
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Modify value of a specifi plotLine

Hi,

You can achieve that by writing a custom function. Here is a demo: https://jsfiddle.net/BlackLabel/7etsxzjb/

Regards!
Magdalena Gut
Developer and Highcharts Support Engineer

Return to “Highcharts Stock”