Google Chart Visualization loading issue.

10 views
Skip to first unread message

Komal Shah

unread,
Aug 7, 2019, 1:30:41 AM8/7/19
to Angular and AngularJS discussion
Hi 
I am using Google charts in my Project and have created a directive for the same.
The issue with chart is whenever I am passing data from Parent component to directive google.visualization is not getting loaded.
But if I wrap the with setTimeout method , its getting loaded.Has anyone faced such a issue.
Help would be appreciate

Regards,
Komal
setTimeout(() => {
google.load("visualization", "1", {packages: ["corechart"]});
google.setOnLoadCallback(this.drawChart());
}, 1000);

Sander Elias

unread,
Aug 14, 2019, 4:44:21 AM8/14/19
to Angular and AngularJS discussion
Hi Komal,

This is about change-detection. The setTimeout forces a cycle in the change-detection.
Also, it might take some time to load and draw the chart, and your generous time allows for this.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages