我尝试过使用连击,或者只是添加了一个线系列,但是最终将这些条推到同一根轴上。我正在尝试获取下面的代码以在图像中添加一行。该代码仅用于使栏杆正常工作的上下文。
google.load('visualization', '1.1', {
'packages': ['bar', 'corechart']
});
google.setOnLoadCallback(drawStuff);
function drawStuff() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Stuff');
data.addColumn('number', 'Things');
data.addColumn('number', 'Clutter');
data.addColumn('number', 'Important');
data.addColumn('number', 'Meh');
data.addRows([
['2001', 321, 621, 816, 319],
['2002', 163, 231, 539, 594],
['2003', 125, 819, 123, 578],
['2004', 197, 536, 613, 298]
]);
// Set chart options
var options = {
isStacked: true,
series: {
2: {
targetAxisIndex: 1
},
3: {
targetAxisIndex: 1
},
}
};
// Instantiate and draw our chart, passing in some options.
var chart = new google.charts.Bar(document.getElementById('chart_div'));
chart.draw(data, google.charts.Bar.convertOptions(options));
};