First, you need to remove the "view" parameter from the PieChart's
ChartWrapper - it is not needed since you are constructing a new DataTable
for the PieChart to draw from.
var pie = new google.visualization.ChartWrapper({
chartType: 'PieChart',
containerId: 'chart1',
options: options
});
Second, I see that you are using a document ready event handler to set up
your AJAX request, which then calls the drawChart function. The problem
with this approach is that it is possible for document ready to fire, the
user to trigger the AJAX request, and the AJAX request to return all before
the Visualization API finishes loading; if this happens, your code will
throw errors trying to render the charts, or the chart will render
improperly. It seems unlikely, but I've dealt with other users who have
run into this exact problem before. If you change from a document ready
event handler to a callback from the google loader, you can avoid this
problem:
google.load('visualization', '1', { 'packages': ['corechart', 'controls'],
callback: function () {
// code from your document ready handler
}});
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.