[Chartjs]-Chart.js โ€“ (intermediate value).Doughnut is not a function

1๐Ÿ‘

If you have switched to chart.js v2, this error will occur since there is a new syntax.

Here is a link to the issue and here is a link to the new syntax.

Here is an example:

var config = {
    type: 'pie',
    data: {
        datasets: [{
            data: [
                pAmt,
                iAmt,
                pFee
            ],
            backgroundColor: [
                "#F7464A",
                "#46BFBD",
                "#FDB45C"
            ],
        }],
        labels: [
            "Principal Amount",
            "Interest Amount",
            "Processing Fee"
        ]
    },
    options: {
        responsive: true
    }
};

window.onload = function() {
    var ctx = document.getElementById("emichart").getContext("2d");
    window.myPie = new Chart(ctx, config);
};

Leave a comment