Chartjs-Separating list of data in Ajax

0👍

You need to have charts as separate entities:

// Put all the instances of Chart into a single array
let charts = [chart1, chart2, ... ]

// when the data comes back, do the following:
let data = [80, 70, ... ] // example data

data.map((value, index) => {
   let chart = charts[index];
   // assign data to chart
   chart.data = value;
})

Leave a comment