Chartjs-How to display Json object in chart js consisting of lists created using Django rest framework in angular application

0👍

When assigning your data to Data and Labels, you should parse the string into an array using JSON.parse().

Instead of this…

result.forEach(x => {
  this.Data.push(x.data);
  this.Labels.push(x.labels);
});

do this:

result.forEach(x => {
  this.Data = JSON.parse(x.data);
  this.Labels = JSON.parse(x.labels);
});

Leave a comment