How to show only integer values on yAxis of HighChart?

后端 未结 1 1525
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 00:08

We have a set of a data that contains counts of instances of events. These can only be integers. When we display data that has a high enough yValue the yAxis labels are integers

1条回答
  •  一向
    一向 (楼主)
    2021-02-05 00:52

    Set the allowDecimals option in the y axis to false in order to prevent non integer tick marks from being displayed:

    yAxis: {
        allowDecimals: false,
        labels: {
            style: {
                fontSize: '9px',
                width: '175px'
            }
        },
        title: {
            text: ''
        }
    }
    

    Here is a demonstration: http://jsfiddle.net/sBC9K/

    0 讨论(0)
提交回复
热议问题