I have this chart that works normally
var ctx = document.getElementById("myChart").getContext("2d");
const cfg = {
type: 'bar',
data: {
datasets: [{
data: receivedData,
label:"testSet"
}]
},
options: {
parsing: {
yAxisKey: 'COUNT',
xAxisKey: 'MODEL'
}
}
};
var myChart = new Chart(ctx, cfg);
receivedData contains objects with the following properties
{MODEL:"model name", COUNT:10}
the problem is if i try to change the chart's type to pie or doughnut, then the chart won't render, bar and line works normally though.
is this some sort of bug or am i doing something wrong?
i'm using chart.js's latest version
At the moment you cant use object notation for doughnut/pie charts, there is an enchancement issue open currently in their repo for this: https://github.com/chartjs/Chart.js/issues/9440
So you will need to transform your object to the normal labels and data array first if you want to show your data as a pie/doughnut chart