How to show only integers (no decimals) in chart API x/y-axis labels

前端 未结 11 1442
予麋鹿
予麋鹿 2021-02-03 23:10

I\'m using a column chart with the Google Chart JS Api. I\'m displaying some values (total orders by day) that can only be represented as integers.

Everything is work

11条回答
  •  轮回少年
    2021-02-03 23:50

    Adding {format : 0} converts the float ticks to integers but the actual values on the bars appear incorrectly.

    The main issue is Google Charts API assumes you want 5 gridlines mostly which may not work out to give you integer tick values.

    Adding this gave me nice round tick values -

      gridlines: { count: -1}
    

    source - https://groups.google.com/forum/#!topic/google-visualization-api/4qCeUgE-OmU

提交回复
热议问题