How to enable Google chart API without calling google.load ()?

jQuery, jQuery UI and Google Maps can be loaded from Google CDN in two ways: either using google.load () :

<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1"); google.load("jqueryui", "1"); google.load("maps", "3", {other_params: "language=de&sensor=false"}); </script> 

or using the <script src = "..."> tags:

 <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&language=de"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script> 

Is there another 2nd method for the Google Charts API ?

Only this method works for me:

 <script type="text/javascript"> google.load('visualization', '1.0', {'packages':['corechart']}); </script> 

but I can not find the URL for the second method.

And I would prefer to enable the Google Charts API statically, because it looks more understandable to me and because of my current problem with DataTables.net .

When I browse resources using the Google Chrome console, I can see the address, for example

https://www.google.com/uds/api/visualization/1.0/342b7b8453344477d252440b6c1305c9/format+en,default,corechart.I.js

but I think this is temporary, which expires ...

+6
source share
2 answers

I found an autoloading workaround:

 <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart'],'language':'ru'}]}"> </script> 

UPDATE 2017:

Chrome displays this warning, though:

?

JSAPI autoload = {'modules': [{' name ':' visualization ',' version ':' 1 ',' packages': ['corechart', 'table'], '...: 22 Parser lock, cross - the beginning of the script, https://www.google.com/uds/api/visualization/1.0/84dc8f392c72d48b78b72f8a2e79c1a1/format+ru,default+ru,ui+ru,table+ru,corechart+ru.I.js , is called through document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details. google.loader.f @? JSAPI autoload = {'modules': [{' Name ':' visualization ',' version ':' 1 ',' packages': ['corechart', 'table'], '...: 22 (anonymous) @ ? JSAPI autoload = {'modules': [{' Name ':' visualization ',' version ':' 1 ',' packages': ['corechart', 'table'], '...: 54

+14
source

I also tried to find out - my whole search indicates that there is no direct link to the chart API (which is a shame). In the end, I ended up using the graphics card API: https://developers.google.com/chart/image/

+1
source

Source: https://habr.com/ru/post/912127/


All Articles