How do I set a minimum upper bound for an axis in Highcharts?

后端 未结 5 826
无人共我
无人共我 2021-01-12 07:04

I\'m trying to set a minimum upper bound, specifically:

  • The Y axis should start at 0
  • The Y axis should go to at least 10, or higher (automatically sca
5条回答
  •  执念已碎
    2021-01-12 07:26

    A way to do this only using options (no events or functions) is:

    yAxis: {
        min: 0,
        minRange: 10,
        maxPadding: 0
    }
    

    Here minRange defines the minimum span of the axis. maxPadding defaults to 0.01 which would make the axis longer than 10, so we set it to zero instead.

    This yields the same results as a setExtreme would give. See this JSFiddle demonstration.

提交回复
热议问题