Onload callback not called until page finished loading

62 views
Skip to first unread message

Henry Chan

unread,
Aug 7, 2017, 6:38:45 AM8/7/17
to Google Visualization API
In the old version of the jsapi for Google Charts, the loading of packages happened asynchronously and fired the onload callback as soon as it was available.

In the new version of Google Charts, the onloadcallback is not called until after the whole dom is ready.

Is there any way I can get the old behavior back?  I have a super long page and i'd like the charts above the fold to render first and immediately.

Daniel LaLiberte

unread,
Aug 7, 2017, 9:53:30 AM8/7/17
to Google Visualization API
Rendering properly can't happen until the container element is visible, at least currently.  The reason is that the measurement of how much space text will take up requires the container element to tell it how large the text is.

That's the main reason that the loader waits for the dom to finish loading.  The old loader should also have been doing that, but there were cases where it was not.

However, if you can render your charts without this restriction, there is now a setting, ignoreWindowOnLoad, available in the most recent version (version 45.2 or later) that lets you proceed without waiting for the dom to finish loading. 

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/aa50d860-a070-42b1-9568-8575fc3cb2bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages