18
我有一些數據,我嘗試使用Google Visualization API(Google Chart Tools)顯示。我已經能夠創建圖形,除了輔助Y軸應該顯示爲百分比而不是常規數字之外,它看起來很棒。這是我的代碼和生成的圖片。Google可視化API格式輔助Y軸與主要Y軸不同
google.load('visualization', '1', {packages: ['corechart']});
function drawVisualization() {
//Some raw data (not necessarily accurate)'
var data = google.visualization.arrayToDataTable([
['AuditPeriod', 'Audit Count', 'Fail Percentage'],
['02-11-2012', 0, 0],
['02-18-2012', 0, 0],
['02-25-2012', 0, 0],
...
['07-21-2012', 1476, .233062],
['07-28-2012', 1651, .253180],
['08-04-2012', 2217, .210645]
]);
var options = {
vAxis: [0: {format: '#,###'}, 1: {format: '#%'}],
hAxis: { title: "Week", format: 'm/d/y'},
series: {
0:{ type: "bars", targetAxisIndex: 0 },
1: { type: "line", targetAxisIndex: 1}
}
}
var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
如果我設置vAxis:{format: '#%'}
然後兩個軸都被格式化作爲我不想百分比。有沒有辦法格式化第一個軸的第二個軸?
類似的:http://stackoverflow.com/questions/29383827/visualization-combo-chart-dual-axis-chart – NoNaMe 2015-04-07 05:21:41