JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.7.1/dist/chart.min.js"></script>
<canvas id="chart_id" width="400" height="200"></canvas>
JavaScript
const ctx = document.getElementById('chart_id').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Orange'],
datasets: [{
label: 'Different colors bars',
data: [90, 100, 80, 50, 70],
backgroundColor: ["#ed1e1e", "#2269e5", "#fce302", "#04f759", "#fc9700"]
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});