1👍
✅
Turns out that the issue wasn’t chart.js at all; it was the asynchronous nature of data retrieval from Firebase. I added a ref.on(….) and populate the arrays as mentioned in the answer by @john townsend, and it is rendering correctly now.
Thanks for your help!
1👍
You will want to do
this.weightChart.data.datasets[0].data.concat(weightArr);
this.weightChart.update();
And so on for the other datasets. If the concat isn’t working, you’ll want to loop through weightArr and push to the chart, then update.
for (var i = 0 ; i < weightArr.length; i++){
this.weightChart.data.datasets[0].data.push(weightArr[i]);
}
this.weightChart.update();
Hope this helps!
Source:stackexchange.com