Chartjs-Plotting JSON data onto a chart using Chart.js

2👍

You always override data when you make it equal with the current item and will be equal to the last element after the cycle. You need to add elements to it, so there will be more elements in the chart.

$.each(res, function(i, item) {
    if (!Array.isArray(data)) {
        data = [];
    }
    data.push({
        label: i,
        value: item
    });
}
var myDoughnutChart = new Chart(ctx).Pie(data);

0👍

its very easy

go to chart.js script and replace label and value with Email addresses and ip addresses..
initially it was accepting label and value and some optional properties like color and all…

hope it vl help

Leave a comment