我有一个要渲染的直方图ColumnCharts
,我按照教程进行操作,结果如下:
注意图表两端的间距(特别是左侧,因为右侧有一些非常小的列)
我尝试使用viewWindow
,但似乎没有特别的效果。这是用于绘制它的代码(coffeescript)。数据已被截断以节省空间,因为它们相当大
data = google.visualization.arrayToDataTable([
labels, bardata
])
# The labels are ["x", "label for each column" ....]
# bardata is [number, number, number] (these numbers are the height of the column)
chart = new google.visualization.ColumnChart(document.getElementById("enrollment-total-chart"))
chart.draw(data,
width: 400
height: 300
hAxis:
title: "Number of students"
vAxis:
title: "Number of schools"
viewWindow:
max: "auto"
min: 0
viewWindowMode: "explicit"
legend: position: "none"
)