45 lines
1.2 KiB
HTML
45 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Chart.js Example</title>
|
|
</head>
|
|
<body>
|
|
<canvas id="myChart"></canvas>
|
|
|
|
<!-- Load Chart.js and plugins -->
|
|
<script src="js/chart.min.js"></script>
|
|
<script src="js/chartjs-plugin-datalabels.min.js"></script>
|
|
<script src="js/chartjs-plugin-annotation.min.js"></script>
|
|
|
|
<!-- Your chart initialization code -->
|
|
<script>
|
|
const ctx = document.getElementById('myChart').getContext('2d');
|
|
new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ['Red', 'Blue', 'Yellow'],
|
|
datasets: [{
|
|
label: '# of Votes',
|
|
data: [12, 19, 3]
|
|
}]
|
|
},
|
|
options: {
|
|
plugins: {
|
|
datalabels: {
|
|
// plugin options
|
|
},
|
|
annotation: {
|
|
// plugin options
|
|
}
|
|
},
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|