[Chartjs]-Chartjs barchart generate data for an array dataset

0👍

Not sure what data you’re trying to generate but if you want to use the method Array.from(), your code could look as follows:

function generateDataSets() {
  return Array.from(new Array(5), (o, i) => ({
    name: 'Land',
    people: (i + 1) * 100,
    backgroundColor: ["#3e95cd"]
  }));
}

console.log(generateDataSets());

Leave a comment