1👍
✅
It doesn’t work because you initially create the chart with wrong configuration. The labels
and datasets
arrays must be contained in a data
object.
Try this instead:
var chart = new Chart(canvas, {
type: 'line',
data: {
labels: [],
datasets: [{
label: 'My Dataset',
data: []
}]
}
});
Source:stackexchange.com