13

i'm using google charts google.load("visualization", "1", {packages:["corechart"]});

but the loading time is very slow upon checking the network usage i found that format+en,default,corechart.I.js is taking approx 6 seconds to load. any work around to reduce this time and why isn't this file being cached and every time it is fetched again from the google.

1
  • same issue with me. you found any solution.
    – jayesh
    Commented Feb 25, 2014 at 10:03

1 Answer 1

7

Unfortunately, due to google's terms of service you aren't able to cache/store the library legally.

Your users' computers must have access to https://www.google.com/jsapi in order to use the interactive features of Google Charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included jsapi script, and is called when you invoke the google.load() method. Our terms of service do not allow you to download the google.load or google.visualization code to use offline.

Link

I would suggest trying the following:

  1. If you are running the app locally try using a different internet connection or even better, hosting the app to see if this increases performance. It may just be a high latency internet connection.
  2. Attempt to find a place to load the library prior to the view that renders the charts. This may not be a possibility but wanted to throw that out there.

If you are loading other assets over CDN and aren't seeing similar problems then it may be something else. If that's the case I would suggest posting some code so we can see how you are calling the api in your app.

Best of luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.