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

前端 未结 11 1353
予麋鹿
予麋鹿 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:51

    if you want only the integer values to be shown, you should take to account that google charts wants to show you at least 5 gridlines. Presuming all of them should be integer give the graph following:

    vAxis: {  title: 'Orders Count',
    
                    minValue: 4,                    
                    viewWindow:{min:0}, /*this also makes 0 = min value*/         
                    format: '0',                     
                },
    

提交回复
热议问题