I have a pie chart like this:
this.canvas = document.getElementById('chart');
this.ctx = this.canvas.getContext('2d');
const myChart = new Chart(this.ctx, {
type: 'pie',
data: {
labels: names,
datasets: [{
label: '# of dogs',
data: data,
backgroundColor: color???,
borderWidth: 1
}]
},
options: {
responsive: false,
display: true
}
});
data is not a fixed data. It is an array and can contain different data. How can I make that each piece of the pie chart has a different color?
Thanks!