我正在使用google api绘制堆积条形图,我想要两个hAxis for graph(数字格式中的前一个和%格式下的一个)。我正在使用此代码来渲染图形。
任何人都可以建议如何将顶级hAxis添加为数字吗?
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Year', 'Austria', 'Bulgaria', 'Denmark', 'Greece'],
['2003',1360,1001,1082,1974],
['2004',1556,1649,1150,1495]
]);
// Create and draw the visualization.
new google.visualization.BarChart(document.getElementById('visualization')).
draw(data,
{title:"Yearly Coffee Consumption by Country",
width:600, height:400,
vAxis: {title: "Year"},
isStacked:true,
hAxes:{0:{title:'Losses in percentage',format:'#,#%'},
1:{title:'Losses in number'}
},
series:{0:{targetAxisIndex:0},1:{targetAxisIndex:1}}
}
);
}