<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Bar Chart Example with Chart.js</title>
<script src=
"https://cdn.jsdelivr.net/npm/chart.js">
</script>
</head>
<body>
<canvas id="myChart"></canvas>
<script>
const cfg = {
type: 'bar',
data: {
labels: ['a', 'b'], // Labels should be here
datasets: [{
label: 'My First Dataset',
data: [20, 10],
backgroundColor:
['rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)'],
borderColor:
['rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)'],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
};
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, cfg);
</script>
</body>
</html>