This is a follow up to my previous question. I apologize if this is too complex to answer here.
I am trying to be able to show my data in a timeline view. I found a timeline script from Google here: https://developers.google.com/chart/interactive/docs/gallery/timeline
But I'm not sure I am doing this correctly. I'm assuming I am supposed to:
Add https://www.gstatic.com/charts/loader.js under the Settings section of my app.
Then am I inserting this code as a client script?
google.charts.load('current', {'packages':['timeline']});
google.charts.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: 'President' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Washington', new Date(1789, 3, 30), new Date(1797, 2, 4) ],
[ 'Adams', new Date(1797, 2, 4), new Date(1801, 2, 4) ],
[ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]);
chart.draw(dataTable);
}
If so, I'm confused as I am getting an error: drawChart was used before it was defined.
I was then HOPING I would swap out 'Washington' for @datasources.item.FieldName and the dates for @datasources.item.StartDate and @datasources.item.EndDate.
But maybe I am totally misunderstanding how this could actually work.
Also to actually show the table would I be using an HTML widget?
Thank you for any help anyone could offer.