Hi,

Remove this line " google.setOnLoadCallback(drawChart); " and try it..

Thanks,
Raja.

On Apr 23, 1:37 am, PeGa <[email protected]> wrote:
> Hello,
>
> I am having trouble when trying to implement the Google Visualization
> API to show the graph only when a user clicks on the button. Everytime
> time I click on "Show Graph" button, it just keeps loading. Any idea
> what I am doing wrong?
>
> Thanks
> PeGa
>
> <html>
>   <head>
>
>     <script type='text/javascript' src='http://www.google.com/jsapi'></
> script>
>     <script type='text/javascript'>
>         function graph() {
>
>         google.load('visualization', '1', {'packages':
> ['annotatedtimeline']});
>       google.setOnLoadCallback(drawChart);
>       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('chart_div'));
>         chart.draw(data, {displayAnnotations: true});
>         }
>       }
>     </script>
>   </head>
>
>   <body onload="">
>     // Note how you must specify the size of the container element
> explicitly!
>
>     <div id='chart_div' style='width: 700px; height: 240px;'></div>
>         <input type="button" onclick="graph();" value="Show Graph"></input>
>   </body>
> </html>
>
> --
> 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 
> athttp://groups.google.com/group/google-visualization-api?hl=en.

-- 
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.

Reply via email to