为简单起见,我为问题jsfiddle制作了此图表。 我可以按秒或分钟或小时对这些条形图进行分组吗? 新的分组条应该具有值2但不是1,即分组的条形它是总和 jsfiddle中的代码:
google.charts.load('current', {'packages':['bar']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('timeofday', 'Time of Day');
data.addColumn('number', 'Emails Received');
data.addRows([
[[8,30,30],1],
[[8,30,30],1],
[[8,30,31],1],
[[8,30,31],1],
[[8,30,32],1],
[[8,30,32],1],
[[8,30,33],1],
[[8,30,33],1],
[[8,30,34],1],
[[8,30,34],1],
]);
var options = google.charts.Bar.convertOptions({
title: 'Total Emails Received Throughout the Day',
height: 450
});
var chart = new google.charts.Bar(document.getElementById('chart_div'));
chart.draw(data, options);
}