height: 400,
tooltip: {isHtml: true},
};
var dataRaw = response.getDataTable();
// Get the number of rows in the original datatable
var rowsRaw = dataRaw.getNumberOfRows();
// Create new datatable called dataNew
var dataNew = new google.visualization.DataTable();
// Add the new columns to dataNew
dataNew.addColumn({ type: 'string', id: 'Faculty' });
dataNew.addColumn({ type: 'string', id: 'bar label' });
dataNew.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}})
dataNew.addColumn({ type: 'date', id: 'Start' });
dataNew.addColumn({ type: 'date', id: 'End' });
// Start stepping through the original datatable
var i;
var j;
// for each row
for (i=0; i < rowsRaw; i++) {
// Create a new row in dataNew
dataNew.addRow();
// for each new column (there are 5 of them). No need to do column 1 as that's null anyway
for (j = 0; j < 5; j++){
if (j==0) { dataNew.setValue(i, j, dataRaw.getValue(i,j)); }
if (j==2) { dataNew.setValue(i, j, "<p><b>" + dataNew.getValue(i, 0) + "</b></p><p>Service: " + dataRaw.getValue(i,1) + " to " + dataRaw.getValue(i,2) + " (" + (dataRaw.getValue(i,2) - dataRaw.getValue(i,1)) + " years)</p>"); }
if (j==3) { dataNew.setValue(i, j, new Date(dataRaw.getValue(i,1), 0, 0)); }
if (j==4) { dataNew.setValue(i, j, new Date(dataRaw.getValue(i,2), 0, 0)); }
}
}
// Destroy dataRaw table
dataRaw = {};
var chart = new google.visualization.Timeline(document.getElementById('timelineNewTooltips_div'));
chart.draw(dataNew, options);
}
})();
</script>
<style>div.google-visualization-tooltip { padding: 6px; width: 200px;}</style>
<div id="timelineNewTooltips_div"></div>