JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="myChart" width="400" height="200"></canvas>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js"></script>
JavaScript
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr'],
datasets: [{
label: 'Months',
data: [50, 30, 90, 70]
}]
},
options: {
plugins: {
title: {
display: true,
text: 'Title goes here ...',
color: '#0055ff',
position: 'bottom',
fullSize: true,
padding: 30,
align: 'start',
font: {
family: 'Arial',
size: 30,
weight: 'bold',
style: 'italic',
lineHeight: 2.0
}
}
}
}
});