[Chartjs]-Pie chart isn't loading, but the labels are

1👍

According to the ChartJS documenation, the expected data passed for a pie chart is numbers only. Here’s an example of a dataset that should work:

data = {
    datasets: [{
        data: [10, 20, 30]
    }],

    // These labels appear in the legend and in the tooltips when hovering different arcs
    labels: [
        'Red',
        'Yellow',
        'Blue'
    ]
};

Currently, your Ajax request is getting the name and email from the /users route; you will need to update the request to get some sort of number value from /users and add that to the dataset.

Leave a comment