Creating Google Pie Chart based on JSON data using CodeIgniter
instead of:
var popularCategory = google.visualization.DataTable(jsonData);
you must have:
var popularCategory = new google.visualization.DataTable(jsonData);
Your json variable has data in incorrect format. Please check the pie chart example here:
https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart
Try the php json encode function:
echo json_encode($whatever);
And also, make sure you start using console.log(jsonData) because the browser console will output the 'jsonData' variable similar to print_r in php. I never get json formatting correct the first time so the console.log(jsonData) feature is absolutely killer.