0👍
Late to the party but I don’t see a response yet and I was also having trouble figuring it out.
Simply include
<script>
Chart.register('chartjs-plugin-annotation');
Chart.register('chartjs-plugin-datalabels');
// ... rest of your code
</script>
somewhere near the top of your scripts after your CDN imports.
As per the Chartjs plugin documentation, this will work with any plugin that follows the naming convention chartjs-plugin-*
Edit:
Adding a working example; credit to @dennis-bauszus for most of the chart layout.
https://codepen.io/jarrilla/pen/OJjMVEo
- [Chartjs]-How to feed hour and minute data into chartJS
- [Chartjs]-How to make a chart.js bar chart scrollable
Source:stackexchange.com