Chartjs-Chart Js Doughnut chart giving error

0👍

The syntax is different if you are using Chart.js v1 or v2.

And you said you imported the v2 library, but you are still using the v1 syntax with :

var chart = new Chart(ctx).Doughnut(data);

To fix this, you can change the syntax to the v2’s :

var myChart = new Chart(ctx, {
    type: 'doughnut',
    data: data
});

Leave a comment