Chartjs-Chart.js – cannot read property

2👍

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
};
new Chart(document.getElementById("product-linechart").getContext("2d")).Line(data, {
  responsive: true,
  maintainAspectRatio: false
});

Demo Fiddle

Leave a comment