Pie chart in php with mysql data using chart.js

0👍

Iterate over your data coming from json response and push the data in an Array

var piedata = [];
$.each(yourJson,function(i,val){
piedata.push({value:val.value,color:val.color,label:val.label,labelColor:val.labelColor  });
});

and then set new Chart(ctx).Pie(piedata);

Leave a comment