<!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>Chart.js Example with Scale Title Configuration</title>
</head>
<body>
<div>
<h2 style="color:green">
GeeksforGeeks
</h2>
<h5>Scale Title Configuration </h5>
<div>
<canvas id="myChart"
width="700"
height="300">
</canvas>
</div>
</div>
<script>
const labels = ['January', 'February',
'March', 'April',
'May', 'June', 'July'];
const data = {
labels: labels,
datasets: [{
label: 'GeeksforGeeks Visitors',
data: [90, 85, 80, 75, 95, 88, 92],
backgroundColor: 'rgba(75, 192, 192, 0.5)',
borderColor: 'rgb(75, 192, 192)',
borderWidth: 1,
}]
};
const config = {
type: 'bar',
data: data,
options: {
scales: {
y: {
title: {
display: true,
align: 'center',
text: 'GeeksforGeeks Visits',
color: 'black',
font: {
family: 'Arial',
size: 16,
weight: 'bold',
},
padding: {
top: 10,
bottom: 5,
left: 0,
right: 0,
},
},
},
},
},
};
let ctx = document.getElementById('myChart')
.getContext('2d');
let myChart = new Chart(ctx, config);
</script>
</body>
</html>