我想只显示YAxis中的整数
PaymentTransaction.group_by_day(:created_at, format: "%b %d, %Y").count,discrete: true, allowDecimals: false,yAxis: {allowDecimals: false}
答案 0 :(得分:1)
如果你使用谷歌图表,那么你可以这样做:
data = PaymentTransaction.group_by_day(:created_at, format: "%b %d, %Y").count
y = data.map(&:last)
y_discrete = ((y.min.floor)..(y.max.ceil)).to_a
options = { vAxis: { ticks: y_discrete } }
line_chart(data, { library: options })