djoshi
Posts: 61
Joined: Fri Mar 26, 2021 5:16 pm

Dynamic Y axis label change

Hi

I am using the following code:

Code: Select all

  yAxis: {
        gridLineColor: '#bfd8dc',
        gridLineWidth: 2,
        min: 0,
        opposite: false,
        title: {
          text :this.yaxis_main_plot,
          style: { "color": "#010101", "fontSize": "12px" }
        },
I have a single plot that dynamically changes its dataset based on what the user press. This also means we need to change some label

At the moment, we need to refresh the entire plot by re-loading it via a function to change the label. Is it possible to do this dynamically?
kamil.k
Posts: 458
Joined: Thu Oct 06, 2022 12:49 pm

Re: Dynamic Y axis label change

Hello djoshi!

Thanks for contacting us again.

To update the label dynamically, you have to update the chart's instance, take a look: https://jsfiddle.net/BlackLabel/h6Lqf5c9/. Note that I referred to the yAxis and used the update method to directly update the axis. You can read more about it here: https://api.highcharts.com/class-refere ... xis#update.

Alternatively, you can use the setTitle method that is related to updating the axis label: https://api.highcharts.com/class-refere ... s#setTitle.

Let me know if that was what you were looking for,
Kind Regards!
Kamil Kubik
Highcharts Developer

Return to “Highcharts Stock”