Highcharts: Ensure y-Axis 0 value is at chart bottom

后端 未结 8 1903
名媛妹妹
名媛妹妹 2021-02-05 02:18

I\'m outputting a series of highcharts on a page. In some instances, all data for the specified time period may come back with 0 values.

In such a case, the chart looks

8条回答
  •  萌比男神i
    2021-02-05 02:54

    I've found another (and very simple) solution:

    You can set y-axis minRange property:

    yAxis: {
        ...
        minRange : 0.1
    }
    

    This makes Highcharts render yAxis min and max values when all data is 0.

    UPDATE:

    Highcharts 4.1.9 fix also needs:

            plotOptions: {
                line: {
                    softThreshold: false
                }
            }
    

    updated js fiddle

提交回复
热议问题