Chart.js - Cannot Read Property
I want to create a chart with multiple lines (multiple datasets) using Django and ChartJS. I'm adding a data into the data attribute, separated by dash (-) for each line and by co
Solution 1:
Because you haven't had lables
in dataset
provide to Chart API. So when ChartJS trying to render a chart it looks for labels before plotting each data on the graph.
var data = {
datasets: datasets,
labels : ["10","20","30","40","50","60","70","80","90","100"] //<-- added labels
};
newChart(document.getElementById("product-linechart").getContext("2d")).Line(data, {
responsive: true,
maintainAspectRatio: false
});
Post a Comment for "Chart.js - Cannot Read Property"