Google Timeline :: Bad version while using gstatic

64 views
Skip to first unread message

shyam.ag...@gmail.com

unread,
Aug 20, 2020, 12:11:22 AM8/20/20
to Google Visualization API
Hi,
I have downloaded https://www.gstatic.com/charts/loader.js in my project as lib file to avoid calling JS script dynamically on the fly.

I used below code to generate timeline visualization, 
<script type="text/javascript" src="../lib/loader.js"></script>  -- (static lib folder path in my src code)
<script>
google.charts.load('1.1', {packages: ['timeline']});
google.charts.setOnLoadCallback(drawChart);
</script>
But in console, I am getting Bad version error.

Uncaught (in promise) Error: Bad version: 1.1
    at loader.js:133

When I use below code, it works perfectly.
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>
  google.charts.load('current', {packages: ['timeline']});
  google.charts.setOnLoadCallback(drawChart);
</script>  

Please let me know how to resolve this.  

Thanks,
Shyam 

Daniel LaLiberte

unread,
Aug 20, 2020, 11:28:19 AM8/20/20
to Google Visualization API
The loader at  https://www.gstatic.com/charts/loader.js is really just the top-level loader that then redirects to another loader based on which version you are loading as specified with your google.charts.load call.  So you are not escaping the dynamic loading of code by downloading the top-level loader.  Also, the top-level loader does get updated from time to time, at least every time there is a new release, and so it is not a good idea to save your own copy of it.  The support for loading '1.1' was added fairly recently, actually, so if your copy is older, that would explain the failure.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/8727abca-e4a0-4d54-99bf-635b87e2554an%40googlegroups.com.


--

shyam.ag...@gmail.com

unread,
Aug 20, 2020, 9:38:33 PM8/20/20
to Google Visualization API
Hi Daniel,
Thank you for providing your input.
Could you please guide me what all libraries I need to download to stick to one version rather than using latest all the time? In my environment, we cannot access library using URL due to security constraints, can you guide me how can I proceed and what should be the version I should use?

Thanks,
Shyam Agrawal

Daniel LaLiberte

unread,
Aug 20, 2020, 10:04:08 PM8/20/20
to Google Visualization API
The instructions on how to use the loader are at:   https://developers.google.com/chart/interactive/docs/basic_load_libs

Change 'current' to a particular version number, as described on the Release Notes page:

You can use your browser's debugger to observe all the files that the loader loads into your browser when you visit a page.

shyam.ag...@gmail.com

unread,
Aug 20, 2020, 11:48:35 PM8/20/20
to Google Visualization API
Hi Daniel,
Thank you so much! I am able to run Chart.

Best Regards,
Shyam
Reply all
Reply to author
Forward
0 new messages