How to Refresh Google Charts After Every Ajax

Google Charts

I found my Google Charts are missing after reloading charts via Ajax, and I found one solution very easy to solve the problems.

Just add an option (highlighted) into your code like this:

Code snippet BEFORE change

google.load("visualization", "1", {
  packages : ['corechart']
});

Code snippet AFTER change

google.load('visualization', '1', {
  packages : ['corechart'], 'callback': drawChart
});

It works fine after every Ajax.

Leave a Reply

Your email address will not be published. Required fields are marked *