Multiple Timelines Chart

99 views
Skip to first unread message

Gianluca Albanese

unread,
Sep 9, 2016, 9:17:57 AM9/9/16
to Google Visualization API
Hi all,
i am using the google timeline plugin (https://developers.google.com/chart/interactive/docs/gallery/timeline) and it works very well, but now I am faced with a problem I can not solve alone.
I developed a page that dynamically creates different timelines graphics, but when I run by obtaining the following error from the console:

Uncaught TypeError: Cannot read property 'Timeline' of undefined

the code of the page javascript that is invoked through a cycle is the following:

function reload_chart(id) {
    	var result = $.ajax("gantt_json.asp", {
  		async: false,
  		data: {fk_obbiettivo: id},
	}).responseText;
	//console.log(result);
	return result;
}
function drawChart(oggetto,id) {
   var container = document.getElementById(oggetto);
   var chart = new google.visualization.Timeline(container);
   var dataTable = new google.visualization.DataTable(reload_chart(id));
   var options = {'title':'Fasi Operative'};
   chart.draw(dataTable,options);
 }
setTimeout(function(){google.charts.load('current',{'packages': ['timeline']})}, 2000

anyone has any idea about it.
Thank you in advance for the help you can give me.


Gianluca

Gianluca Albanese

unread,
Sep 9, 2016, 9:44:17 AM9/9/16
to Google Visualization API
ok i forget to write how i call the function:

<div id="1" style="margin-left:15px; width:220mm; height: 300px;"></div>

<script>
google.charts.setOnLoadCallback(function () {
drawChart('1','10');
});
</script>
Reply all
Reply to author
Forward
0 new messages