<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>GeeksforGeeks Doughnut Chart</title>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js">
</script>
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js">
</script>
</head>
<body>
<div>
<h1 style="color:green;">GeeksforGeeks</h1>
<h3>Chart.js General Fonts - Example 1</h3>
<div>
<canvas id="doughnutChart"
width="400"
height="400">
</canvas>
</div>
</div>
<script>
const data = {
labels: ["Java", "Python",
"C++", "JavaScript",
"C#"],
datasets: [{
data: [25, 30, 15, 20, 10],
backgroundColor: ["#FF6384", "#36A2EB",
"#FFCE56", "#4CAF50",
"#9C27B0"],
}]
};
const config = {
type: 'doughnut',
data: data,
options: {
plugins: {
legend: {
labels: {
font: {
family: 'Courier New',
size: 12,
style: 'normal',
weight: 'bold',
},
},
},
},
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text:
'GeeksforGeeks Doughnut Chart with Different Font Customization',
},
}
};
new Chart($("#doughnutChart"), config);
</script>
</body>
</html>