Code
chartjs
const ctx = document.getElementById('doughnutChart').getContext('2d');
new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Desktop', 'Mobile', 'Tablet'],
datasets: [{
data: [60, 30, 10],
backgroundColor: ['#36A2EB', '#FF6384', '#FFCE56'],
hoverOffset: 8,
borderWidth: 2,
borderColor: '#fff'
}]
},
options: {
responsive: true,
cutout: '65%',
plugins: {
legend: { position: 'bottom' },
title: { display: true, text: 'Device Distribution' }
}
}
});