score:2

Accepted answer

The syntax has changed since 1.0. Your javascript in 2.2.1 should be:

var data = {
    labels: [
        "Java",
        "Scala",
        "PHP",
        "HTML"
    ],
    datasets: [
        {
            data: [25, 10, 30, 35],
            backgroundColor: [
                "#811BD6",
                "#9CBABA",
                "#D18177",
                "#6AE128"
            ]
        }]
};
var ctx = document.getElementById("my-chart");
var myPieChart = new Chart(ctx,{
    type: 'pie',
    data: data
});

FIDDLE

CHARTJS DOCUMENTATION


Related Query

More Query from same tag