Hello, Recently I had a problem caused by the time my page spent to load from the server.
The chart object was being created while the page was not fuly loaded yet , so the container object didn't exists at that time and the chart was not created due to JavaScript error. As you can see at Chart Gallery <https://developers.google.com/chart/interactive/docs/gallery/>, all chart examples are simple and the chart object is created while the page is being loaded. I suggest you split the code in two parts, one containing the options definitions and other containig the call to the library and the callback method as bellow: <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // Options and draw methods definition function drawChart() { var data = google.visualization.arrayToDataTable([ ['Year', 'Sales', 'Expenses'], ['2004', 1000, 400], ['2005', 1170, 460], ['2006', 660, 1120], ['2007', 1030, 540] ]); var options = { title: 'Company Performance', curveType: 'function', legend: { position: 'bottom' } }; var chart = new google.visualization.LineChart(document.getElementById('curve_chart')); chart.draw(data, options); } function pageLoad() { google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); } </script> </head> <body onload="pageLoad();"> <div id="curve_chart" style="width: 900px; height: 500px"></div> </body> </html> This way the library will be loaded after the page is fully loaded and all html objects will have been already created. Please let me know if I have made any code heresy. Best regards. Jayme Jeffman -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/b5094f11-7d92-46ea-b214-145bc634ae80%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
