I see two problems:

1) you named the function you want to call "initialize", but have a 
"drawVisualization" in the callback handler.  Change the callback to 
initialize.
2) when I put this in a fiddle and ran it, I got an error when using the 
query option you specified.  Commenting out that line fixed the problem.

Here's a working version of your code: http://jsfiddle.net/asgallant/Tm32g/

On Sunday, December 23, 2012 1:09:00 AM UTC-5, Nasif Muslim wrote:
>
> Hello,
> I am new to Google Chart and I am trying create a dynamic pie chart in the 
> dynamic webproject(JEE). I have read the tutorial (
> https://developers.google.com/chart/interactive/docs/queries) and copy 
> the pie chart code in the google code play ground.
> ---
>
>
>
>    function initialize() 
>     {
>       // Replace the data source URL on next line with your data source 
> URL.
>       // Specify that we want to use the XmlHttpRequest object to make the 
> query.
>       var opts = {sendMethod: 'xhr'};
>       var query = new google.visualization.Query('
> https://docs.google.com/spreadsheet/tq?range=A%3AB&key=0Aq4N8GK8re42dHlGMG0wM00tdE5PVjJZellXTEhFNEE&gid=0&headers=-1',
>  
> opts);
>       
>       // Send the query with a callback function.
>       query.send(handleQueryResponse);
>     }
>     
>     function handleQueryResponse(response)
>      {
>     
>       if (response.isError()) 
>       {
>         alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
>         return;
>       }
>     
>       var data = response.getDataTable();
>       var chart = new 
> google.visualization.PieChart(document.getElementById('chart_div'));
>       chart.draw(data, {width: 400, height: 240, is3D: true});
>     }
>
>     google.setOnLoadCallback(drawVisualization);
>     </script>
>
> But it is not working and there is no piechart. Could please tell me where 
> is the problem. My spreadsheet is 
> https://docs.google.com/spreadsheet/ccc?key=0Aq4N8GK8re42dHlGMG0wM00tdE5PVjJZellXTEhFNEE
> Thank you.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/ybm58rI2sGYJ.
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