Chartjs-How to correct my dataset so charts.js bar graph will stack

0👍

As stated in the comments, the labels will be an array of your data elements stat_name property and there will be a data set for each entry of your data. You can clean much of the processing of the data into the below:

const chartdata = {
    labels: data.map(item => item.stat_name),
    datasets: data.map(item => ({ data: item.stat_count }));
};

Leave a comment