hhuuthien
Posts: 11
Joined: Wed Mar 01, 2023 6:40 am

Highcharts plotLines value

Hi everyone,

I had a plotLine on yAxis like this example. How can I access the value to render in the text field when the value changed? Anyone please help me. Thanks in advance!

Code: Select all

yAxis: {
        plotLines: [{
            value: 0.6,
            label: {
                text: 'I need to have the value here'
            }
        }]
    },
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Highcharts plotLines value

We appreciate you reaching out to us!

I prepared an example how can you update the label text when a new point is added. You can set plotLine.label.attr.text to the new value you want and also plotLine.options.value to move the plotLine throughout the chart. Then simply invoke .render() on the plotLine and your chart will be updated.

Demo: https://jsfiddle.net/BlackLabel/pvdeuyow/

Feel free to ask any further questions!
Best regards
Jakub
hhuuthien
Posts: 11
Joined: Wed Mar 01, 2023 6:40 am

Re: Highcharts plotLines value

Your answer helped me a lot. Many thanks!
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Highcharts plotLines value

You're welcome!
In case of any further questions, feel free to contact us again.

Regards
Jakub

Return to “Highcharts Stock”