score:7

Accepted answer

You have to assign data before you pass it to the function:

var data = {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.5)",
            strokeColor: "rgba(220,220,220,0.8)",
            highlightFill: "rgba(220,220,220,0.75)",
            highlightStroke: "rgba(220,220,220,1)",
            data: [65, 59, 80, 81, 56, 55, 40]
        }
    ]
};

var sessionsGraph = new Chart(ctx).Bar(data); //Create a chart with "data" array

You probably should also assign Chart.default.global before calling it, but I'm not sure when that's used.


Related Query

More Query from same tag