简体   繁体   中英

Creating Google GeoChart async

I want to put a GeoChart in my app but I don't want to create it when the DOM is loading. I only want to render after a user interaction. I have loaded the google.visualization library including the GeoChart and CoreChart packages.

When I am loading the Chrome console google.visualization.arrayToDataTable and google.visualization.GeoChart are missing! The same code works when executing everything on DOM load.

Any hints on how to properly the load the lib?

Make sure you've included these two lines:

google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawRegionsMap);

But instead of making the callback drawRegionsMap, call some other function that handles when you load your chart. Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM