원하는 것은 콤보 차트입니다. Combo Chart의 예제 코드로 시작하여 마지막 열을 변경하고 두 번째 축을 추가했습니다. 가장 중요한 매개 변수는 targetAxisIndex
매개 변수입니다.
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
['2004/05', 165, 938, 522, 998, 450, 614.6/100],
['2005/06', 135, 1120, 599, 1268, 288, 682/100],
['2006/07', 157, 1167, 587, 807, 397, 623/100],
['2007/08', 139, 1110, 615, 968, 215, 609.4/100],
['2008/09', 136, 691, 629, 1026, 366, 569.6/100]
]);
// Create and draw the visualization.
var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
ac.draw(data, {
title : 'Monthly Coffee Production by Country',
width: 600,
height: 400,
vAxis: {title: "Cups"},
hAxis: {title: "Month"},
seriesType: "bars",
series: {5: {type: "line", "targetAxisIndex": "1"}}
});
}