prakar
unread,Nov 2, 2011, 3:15:06 PM11/2/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Visualization API
Hi,
I am trying to refresh a pie chart created using google visualization
with the help of jquery but it looks somewhere I am missing something
and its not refreshing the pie chart.
I have a spring controller that returns DataTable in json format.
In my jsp, I am showing the pie chart by calling the controller.
google.load('visualization', '1', {'packages':['corechart']});
$(document).ready(function() {
google.setOnLoadCallback(drawIssueChart);
function drawIssueChart() // Send the query to the data source.
{
$.getJSON('/issuelist/home/chart.jsp', function(response) {
var issueChart = new
google.visualization.PieChart(document.getElementById('issue_chart_div'));
var data = new google.visualization.DataTable(response, 0.6);
issueChart.draw(data, {width: 300, height: 300, title: 'Issue
Chart'});
});
}
}
The above works fine without any issue.
I want to change the pie chart using ajax refresh based on the users
selection of select boxes and clicks a submit button. For that I added
the following code
$('#submit').click(function() {
google.setOnLoadCallback(drawIssueChart);
}
When I click on the submit button, the above code results in Uncaught
Error: Container is not defined in
document.getElementById('issue_chart_div'). I changed the code to pass
the element id to the callback function but still the pie chart is not
showing up and there are no errors also. I am able to confirm that the
calback is getting called.
I greatly appreciate any guidance on how to solve this issue.
Thanks
Prakar