I m trying to implement chart.js in angular, have written a simple code to display chart on html, but there is not output on the page, also there are no errors. I m not getting where is the issue and why displaying chart is getting failed. slackblitz url for reference
Code that I m trying in component:
this.chart1 = new Chart('canvas', {
type: 'doughnut',
data: {
labels: ['solid', 'liquid', 'unknown'],
datasets: [
{
label: 'test',
data: [
100, 200, 300
],
backgroundColor: ['#0074D9', '#2ECC40', '#FF4136']
}
]
},
options: {
title: {
display: false,
text: 'Color test'
},
legend: {
position: 'left',
display: true,
fullWidth: true,
labels: {
fontSize: 11
}
},
scales: {
xAxes: [{
display: true
}],
yAxes: [{
display: true
}]
}
}
});
Please help me to understand where I m getting failed, Thanks