<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.1.2/chart.umd.js">
</script>
<title>Bar Chart - Axes Styling</title>
</head>
<body>
<div>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h3>Axes Styling - Bar Chart </h3>
<div style="width:80%;">
<canvas id="barChart"></canvas>
</div>
</div>
<script>
const data = {
labels: ['Python', 'JavaScript', 'Java', 'C++', 'HTML'],
datasets: [{
label: 'GeeksforGeeks Courses',
data: [200, 350, 300, 180, 120],
backgroundColor: 'rgba(75, 192, 192, 0.6)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 2,
}],
};
const config = {
type: 'bar',
data: data,
options: {
scales: {
x: {
display: true,
title: {
display: true,
text: 'Programming Languages',
color: 'blue',
},
ticks: {
color: 'green',
font: { size: 12, weight: 'bold' },
},
grid: {
color: ['red', 'orange',
'yellow', 'green', 'blue'],
display: true,
lineWidth: 2,
drawOnChartArea: false,
},
border: {
display: true,
color: 'purple',
width: 2,
},
},
y: {
display: true,
title: {
display: true,
text: 'Number of Courses',
color: 'red',
},
ticks: {
color: 'orange',
font: { size: 12, weight: 'bold' },
},
grid: {
display: true,
drawTicks: false,
},
},
},
},
};
const myChart =
new Chart(document.getElementById('barChart'), config);
</script>
</body>
</html>