When I push an array to ngx-barchart, the push function adds an empty object to the chart. I loop through the api service and get this:
Then I call the service in barchart.component.ts
single: any = [
{
"name": [],
"value": []
}
];
function to push:
getChartData() {
this.storageService.barChart.subscribe(barChart=> {if(barChart)
barChart.forEach((i) => {
// this.single[0].push({name: (i.skill_name), value: (i.score)})
this.single.push({name: (i.skill_name), value: (i.score)});
});
this.single=[...this.single];
console.log(this.single)
});
};
I'm expecting the to not have an empty object passed to my chart data.
I've tried adding:
this.single[0].push({name: (i.skill_name), value: (i.score)})
But I get ERROR TypeError: _this.single[0].push is not a function