0👍
You can use the Array.map()
method on the usersList
to create the arrays that contain the desired attributes of the users.
Your code would have to be changed as follows:
data: {
labels: usersList.map(u => u.name),
datasets: [{
label: ' Views per channel ',
data: usersList.map(u => u.social),
borderWidth: 1
}]
}
- Chartjs-How to use a Data Array within a Chart JS dataset?
- Chartjs-Chart.js Update start date with button selector
Source:stackexchange.com