我有一個谷歌圖表與百分比值從0到100%(即0至1) 當我設置hAxis.gridlines.count爲10期望獲得網格線在0, 10, 20, ... 90, 100
我得到網格線0, 12, 24, 36, ..., 96, 108
谷歌圖表hAxis.gridlines.count不按預期工作
我現在找不到任何解決方案。
這裏是我的代碼:
function getData() {
// Create the data table.
var data = new google.visualization.arrayToDataTable([
['Category', 'Fulfillment (%)'],
['A', .75],
['B', .50],
['C', .50],
['D', .30],
['E', 0]
]);
// Set chart options
var options = {
'title': 'My Title',
'height': 300,
'backgroundColor': 'none',
'hAxis': {
'maxValue': 1,
format: '#%',
gridlines: {
count: 10
}
},
'colors': ['#F5821E'],
legend: { position: "none" }
};
var formatter = new google.visualization.NumberFormat({ pattern: '#%' });
formatter.format(data, 1);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
差不多:)它是'hAxis.ticks'不是'gridlines.ticks' – 2014-08-28 16:10:44