0👍
Probably a little late, but either way, put this in a js file and load this js file after loading the chart.js file.
const links = document.querySelectorAll(".page-header ul a");
for (const link of links) {
link.addEventListener("click", clickHandler);
}
function clickHandler(e) {
e.preventDefault();
const href = this.getAttribute("href");
const offsetTop = document.querySelector(href).offsetTop;
scroll({
top: offsetTop,
behavior: "smooth"
});
}
- Chartjs-Chart.js: Creating a Barchart with overlaying and offset Bars
- Chartjs-Data not fully displaying on bar chart
Source:stackexchange.com