0👍
You need a 2d context to draw the chart on. Here’s a working example:
Do these 2 changes in your code:
HTML
<canvas id="bar-chart" width="400" height="400"></canvas>
Javascript
var ctx = document.getElementById("bar-chart").getContext("2d");
var myBarChart = new Chart(ctx, ...)
Source: https://www.chartjs.org/docs/latest/#creating-a-chart
- Chartjs-How to add multiple data in chart js dynamically from JSON
- Chartjs-Chartjs not picking up twig variable for label
Source:stackexchange.com