Google Charts API shows blank screen with $(document).ready method

前端 未结 9 1001
清酒与你
清酒与你 2021-02-05 03:36

I\'ve got several functions that instantiate various charts using Google Charts API.

When I call them without jQuery\'s $(document).ready method, everything

9条回答
  •  情歌与酒
    2021-02-05 03:54

    Hi that solution doesn't worked for me, apparently (i'm guessing i'm not sure) google library has some scope issues when you call it inside a jquery object, so the solution is quite simple (although got it wasn't so simple :s) define a global variable and assign the google librari:

    var localGoogle = google;
    

    looks funny huh :)... then use the variable you defined to invoque the setOnCallback, it worked for me i hope it work for you..

    $(document).ready(function(){
        localGoogle.setOnLoadCallback(window.drawColumnChart1);
    }
    

提交回复
热议问题