Re: Problem in Dynamic pie chat in Google chart

107 views
Skip to first unread message

asgallant

unread,
Dec 23, 2012, 10:50:31 AM12/23/12
to google-visua...@googlegroups.com
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'};
      
      // 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.

Nasif Muslim

unread,
Dec 25, 2012, 2:20:01 PM12/25/12
to google-visua...@googlegroups.com
Thank you very much asgallant .
Reply all
Reply to author
Forward
0 new messages