Highcharts - Keep Zero Centered on Y-Axis with Negative Values

前端 未结 5 840
灰色年华
灰色年华 2021-02-13 03:18

I have an area chart with negative values. Nothing insanely different from the example they give, but there\'s one twist: I\'d like to keep zero centered on the Y axis.

5条回答
  •  眼角桃花
    2021-02-13 04:04

    You can do this with the getExtremes and setExtremes methods

    • http://api.highcharts.com/highcharts#Axis.getExtremes%28%29
    • http://api.highcharts.com/highcharts#Axis.setExtremes%28%29

    example:

    http://jsfiddle.net/jlbriggs/j3NTM/1/

    var ext = chart.yAxis[0].getExtremes();
    

提交回复
热议问题