简体   繁体   English

如何在gstatic loader.js Google图表库中添加回调?

[英]How to add callback to gstatic loader.js google charts library?

As mentioned in http://developers.google.com/chart/interactive/docs/basic_load_libs#update-library-loader-code , it is advised to upgrade from old jsapi to new gstatic...loader.js for google charts . http://developers.google.com/chart/interactive/docs/basic_load_libs#update-library-loader-code中所述 ,建议从google chartsjsapi升级到新的gstatic...loader.js

Problem: Currently I'm having callback that is executed after loading of the js file completed: http://www.google.com/jsapi?callback=oldCallback 问题:目前,我正在执行的js文件加载完成后执行的回调: http : //www.google.com/jsapi? callback=oldCallback

But with the new library, this callback is never executed: 但是对于新库,此回调不会执行:

http://www.gstatic.com/charts/loader.js?callback=newCallback http://www.gstatic.com/charts/loader.js?callback=newCallback

Why? 为什么?

Example: https://jsfiddle.net/rLo9vdqm/1/ 示例: https//jsfiddle.net/rLo9vdqm/1/

Listed under the limitations for the new loader.js ... 新的 loader.js限制 loader.js ...

  1. You can't autoload the library. 您无法autoload该库。

which I take as --> you can't include anything on the url... 我认为->您不能在网址中包含任何内容...

you can include it with the load statement however... 可以将其包含在load语句中,但是...

google.charts.load('current', {
  callback: newCallback,
  packages: ['corechart']
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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