0👍
After a lot of experimenting and reading I figured how, I don’t know if it is the best or correct way but it’s working.
The service is fine, the call haves to look like
var bodyFatChartInstance = new Chart(this.bodyfatRef.nativeElement, this.bodyfatService.getChartConfig());
this.bodyfatService.getChart().then(function(data)
{
console.log(data);
data["data"]["datasets"][0]["data"].forEach(element => {
console.log(element);
bodyFatChartInstance.data.datasets[0].data.push(element);
});
data["data"]["labels"].forEach(element => {
bodyFatChartInstance.data.labels.push(element);
});
bodyFatChartInstance.update();
});
- Chartjs-How to change space between columns in horizontalBar in Chart.js?
- Chartjs-How can conditionally show/hide gridlines on the yAxis using Chart.js?
Source:stackexchange.com