google.load("visualization", "1", { packages: ["timeline"] }); google.setOnLoadCallback(drawChart); function drawChart() { var container = document.getElementById('timeline'); var chart = new google.visualization.Timeline(container); var dataTable = new google.visualization.DataTable(); dataTable.addColumn({ type: 'string', id: 'JobType' }); dataTable.addColumn({ type: 'string', id: 'WorkType' }); dataTable.addColumn({ type: 'date', id: 'Start' }); dataTable.addColumn({ type: 'date', id: 'End' }); dataTable.addRows([ ['Excavation', 'Compaction', new Date(2015, 1, 1), new Date(2015, 1, 4)], ['Excavation', 'Step Push', new Date(2015, 1, 1), new Date(2015, 1, 2)], ['Excavation', 'Clean Road', new Date(2015, 1, 4), new Date(2015, 1, 5)], ['Back Fill', 'Load Fill', new Date(2015, 1, 16), new Date(2015, 1, 16)], ['Back Fill', 'Bob Cat', new Date(2015, 1, 16), new Date(2015, 1, 16)], ['Back Fill', 'Backfill', new Date(2015, 1, 17), new Date(2015, 1, 20)], ['Back Fill', 'Clean Road', new Date(2015, 1, 20), new Date(2015, 1, 20)], ['Pre Grade', 'Level Dump', new Date(2015, 2, 23), new Date(2015, 2, 23)], ['Pre Grade', 'Compaction', new Date(2015, 2, 23), new Date(2015, 2, 23)], ['Pre Grade', 'Labourer Work', new Date(2015, 2, 23), new Date(2015, 2, 26)], ['Pre Grade', 'Labourer Work', new Date(2015, 2, 28), new Date(2015, 2, 28)], ['Loaming', 'Load Loam', new Date(2015, 3, 15), new Date(2015, 3, 15)], ['Loaming', 'Level Dump', new Date(2015, 3, 15), new Date(2015, 3, 15)], ['Loaming', 'Compaction', new Date(2015, 3, 15), new Date(2015, 3, 15)], ['Loaming', 'Loam', new Date(2015, 3, 16), new Date(2015, 3, 18)] ]); var options = { timeline: { groupByRowLabel: true } }; chart.draw(dataTable, options); }
<div id="timeline"></div>