Hey VizBoy

Thank you for your reply. I've already tryied to put the code in the head
section and also changed the type for button but it didn“t work.
About the pie chart i post an older version, but the result is the same.
I think the problem is in the line:

google.setOnLoadCallback(drawChart);

for dynamic loading.

I tryed to read the documentation but with no success.

2009/2/28 VizBoy <[email protected]>

> Hi,
>
> Some suggestions:
>
> 1. put the scripts in the <head> part of the document, and put that part
> above the body. Put nothing below the end of the body.
> 2.  Don't use type="submit" but rather type="button" as you don't really
> want to submit any form.
> 3. You said you need a piechart, but you're using an annotatedtimeline in
> your code...
>
> Try these, change you code, and post again with the new code if things
> still aren't working for you.
>
> Regards,
>     VizBoy.
>
>
> On Sat, Feb 28, 2009 at 2:41 PM, Joao Almeida <[email protected]> wrote:
>
>>
>> Hello
>>
>> I'm having some trouble with dynamic loading of a pie chart from
>> Google Visualization. All I want to do is:
>>
>> - when I press a button I want  the chart to appear. But what happens
>> is that the page keeps loading infinitely.
>>
>> I tryed this code and others with no success:
>>
>> <html lang="en">
>> <head>
>>    <title>testing</title>
>> </head>
>> <body>
>>
>>    <input type="submit" value="Submit" onclick="showUser()"></input>
>>
>>    <div id='chart_div' style='width: 800px; height: 350px;'></div>
>> </body>
>>
>> <script type='text/javascript' src='http://www.google.com/jsapi'></
>> script>
>> <script type='text/javascript'>
>>
>> function showUser(){
>>
>>    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(6);
>>        data.setValue(0, 0, new Date(2008, 1 ,1));
>>        data.setValue(0, 1, 30000);
>>        data.setValue(0, 4, 40645);
>>        data.setValue(1, 0, new Date(2008, 1 ,2));
>>        data.setValue(1, 1, 14045);
>>        data.setValue(1, 4, 20374);
>>        data.setValue(2, 0, new Date(2008, 1 ,3));
>>        data.setValue(2, 1, 55022);
>>        data.setValue(2, 4, 50766);
>>        data.setValue(3, 0, new Date(2008, 1 ,4));
>>        data.setValue(3, 1, 75284);
>>        data.setValue(3, 4, 14334);
>>        data.setValue(3, 5, 'Out of Stock');
>>        data.setValue(3, 6, 'Ran out of stock on pens at 4pm');
>>        data.setValue(4, 0, new Date(2008, 1 ,5));
>>        data.setValue(4, 1, 41476);
>>        data.setValue(4, 2, 'Bought Pens');
>>        data.setValue(4, 3, 'Bought 200k pens');
>>        data.setValue(4, 4, 66467);
>>        data.setValue(5, 0, new Date(2008, 1 ,6));
>>        data.setValue(5, 1, 33322);
>>        data.setValue(5, 4, 39463);
>>
>>        var chart = new google.visualization.AnnotatedTimeLine
>> (document.getElementById('chart_div'));
>>        chart.draw(data, {displayAnnotations: true});
>>
>>
>> }
>>    </script>
>>
>>
>> </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 at 
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to