I'm trying to create a list of people who have worked today, with their start and end times. This is no problem for people who have records, but I can't figure out how to get Google's Timeline chart to print a name of someone and then no entries on graph.
Here is the documentation, but it says nothing about blank entries:
https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline#BarsOneRow
Here is a sample of my code:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
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: 'Employee' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Spiderman', new Date(2015, 04, 07, 04, 43, 49), new Date(2015, 04, 07, 06, 45, 05), ],
[ 'Iron Man', new Date(2015, 04, 07, 04, 40, 53), new Date(2015, 04, 07, 08, 45, 47), ],
[ 'Spiderman', new Date(2015, 04, 07, 09, 10, 19), new Date(2015, 04, 07, 13, 22, 02), ],
]);
var options = {
timeline: {
singleColor: '#00f',
colorByRowLabel: true,
groupByRowLabel: true,
},
backgroundColor: '#ffffff'
};
chart.draw(dataTable, options);
}
</script>
What do I need to do to add a row for Superman, even though he didn't work that day?