Skip to content Skip to sidebar Skip to footer

Chart.js Version 2.2.1 Wont Show Chart

I've been trying to get Chart.js version 2.2.1 to show a simple chart using the tutorial from another site.. Even with the most basic data nothing will show. If I use the minified

Solution 1:

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

vardata = {
    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

Post a Comment for "Chart.js Version 2.2.1 Wont Show Chart"