0👍
You can try
const hometownCount = apiCallResult.reduce((acc, it) => {
acc[it.hometown] = (acc[it.hometown] || 0) + 1;
return acc;
}, {});
Hope this helps.
- Chartjs-How can I update my ChartJS in real time (It's works only when I zoom-in and zoom-out)
- Chartjs-Canvas not rendering after animation without resizing viewport
0👍
After a quick search, I found out I was on the right track. I needed Object.keys(hometown)
and Object.values(hometown)
to put in Chartjs for things to work.
Cheers
Source:stackexchange.com