我有以下代码显示所有参与一天的游泳池车。我想要的第一件事是显示24小时的固定hAxis。轴标题将是一个加号。但截至目前,它只显示时间轴,直到它有一个订婚。标题根本没有显示。在此先感谢您的帮助。
google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var container = document.getElementById('chart_div');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Vehicle' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'SEDAN 10', 'Default Function', new Date(0,0,0,17,00,0), new Date(0,0,0,19,00,0) ],
[ 'SEDAN 11', 'IDLE', new Date(0,0,0,0,0,0), new Date(0,0,0,0,0,0) ],
[ 'SEDAN 12', 'IDLE', new Date(0,0,0,0,0,0), new Date(0,0,0,0,0,0) ],
[ 'SEDAN 13', 'IDLE', new Date(0,0,0,0,0,0), new Date(0,0,0,0,0,0) ],
[ 'SEDAN 14', 'IDLE', new Date(0,0,0,0,0,0), new Date(0,0,0,0,0,0) ] ]);
var options = {
hAxis: { title: 'Hours'},
viewWindow: {min: 0, max: 24},
ticks: [0, 6, 12, 18, 24]
timeline: {colorByRowLabel: true},
height: 800
};
chart.draw(dataTable, options);
}