Change HighCharts axis title

前端 未结 5 1243
花落未央
花落未央 2021-02-03 23:44

Is it possible to change the axis title of a HighCharts chart programatically?

I\'m trying to do something like this:

charts.series[0].yAxis.title.text =         


        
5条回答
  •  盖世英雄少女心
    2021-02-04 00:18

    I have created a demo fiddle to dynamically change y-axis title. Refer this JSFIDDLE

    HTML:

    JS (part of thec code to update the y-axis title on a button click):

    var chart = $('#container').highcharts();
        $('#my_btn').click(function(){
            //alert('hey');
            chart.yAxis[0].update({
                title:{
                    text:"My text"
                }
            });
            alert('Y-axis title changed to "My text" !');
        });
    

    Refer Highcharts 'update' function documentation for further details.

提交回复
热议问题