Change HighCharts axis title

前端 未结 5 1361
花落未央
花落未央 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:20

    This can be done directly on the Axis object using setTitle now. For example:

    chart.yAxis[0].setTitle({ text: "Bananas" });
    

    See this JSFiddle demonstration. The method signature is:

    setTitle(Object title, [Boolean redraw])
    

    So you could optionally pass a boolean to wait with redrawing. The title object takes the same parameters as xAxis.title meaning you could pass in styles and several other options as well as the text itself. The API documentation has the complete information.

提交回复
热议问题