1
的我有,我想與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"
)
的數據是相當大的,但你說得對:這是由於在右端非常小的數據。不知道我切換顯示時左端如何。我還通過使用列而不是行來濫用Google DataTable。 – Pwnna
你的軸是否連續?如果沒有,那麼你不能設置ViewWindow(或者可以設置它,但它不會做任何事情)。如果你正在使用一個連續的軸,並且它不工作,那麼我不知道爲什麼。 – jmac