Chartjs-Importing JSON to data and labels for chart.js

-1👍

You need to map your data to required format. CartJs requires data parameter which is in this format data: [{x:'2016-12-25', y:20}, {x:'2016-12-26', y:10}] so you can do something

data: jsonData.map(item => ({x: item.group, y: Number(item.amount)}));

Leave a comment