all you need to do is call the drawing function and not the
setOnCallback... this is since the google API is already loaded.
try this instead:
$('#submit').click(function() {
drawIssueChart();
}
On Wed, Nov 2, 2011 at 9:15 PM, prakar <[email protected]>wrote:
> 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
>
> --
> 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.
>
>
--
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.