I'm trying to create an Annotated timeline chart using the exact same code example that is available on the google playground, however; I would like to put all the javascript in an external file instead of having the javascript inline. When I do this, the page redirects to a blank screen, but if I take out the javascript in the external file and place the javascript inline, inside of the <head>, then everything works fine. Is there no way to place the javascript in an external file? Here is my code:
<html class=" ext-strict" lang="en" xmlns="http://www.w3.org/1999/ xhtml" xml:lang="en" dir="ltr"> <head> <script src="http://www.google.com/jsapi" type="text/javascript"></ script> <script src="annotated.js" type="text/javascript"></script> </head> <body> <div id="google-annotated" style="height: 250px; width: 900px;"></ div> </body> </html> Code inside annotated.js window.onload = function() { google.load('visualization', '1', {'packages': ['annotatedtimeline']}); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); data.addColumn('number', 'Sold Pencils'); data.addColumn('string', 'title1'); data.addColumn('string', 'text1'); data.addColumn('number', 'Sold Pens'); data.addColumn('string', 'title2'); data.addColumn('string', 'text2'); data.addRows([ [new Date(2008, 1 ,1), 30000, undefined, undefined, 40645, undefined, undefined], [new Date(2008, 1 ,2), 14045, undefined, undefined, 20374, undefined, undefined], [new Date(2008, 1 ,3), 55022, undefined, undefined, 50766, undefined, undefined], [new Date(2008, 1 ,4), 75284, undefined, undefined, 14334, 'Out of Stock','Ran out of stock on pens at 4pm'], [new Date(2008, 1 ,5), 41476, 'Bought Pens','Bought 200k pens', 66467, undefined, undefined], [new Date(2008, 1 ,6), 33322, undefined, undefined, 39463, undefined, undefined] ]); var chart = new google.visualization.AnnotatedTimeLine (document.getElementById('google-annotated')); chart.draw(data, {displayAnnotations: true}); } google.setOnLoadCallback(drawChart); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en -~----------~----~----~----~------~----~------~--~---
