Difference between gstatic charts loader link and google jsapi link

3,571 views
Skip to first unread message

KT

unread,
Dec 14, 2015, 4:12:15 PM12/14/15
to Google Visualization API
I am confused as to which link I am supposed to use.  The main Quick Start page shows one link, yet the individual charts documentation show another.

Within the html file:
  1. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  2. <script type="text/javascript" src="https://www.google.com/jsapi"></script>

I also see two different load links and am confused as to which should be used, within my js functions.
  1. google.charts.load('current', {packages: ['corechart']});
  2. google.load('visualization', '1', {'packages':['corechart']});

I am creating and displaying Area charts:

        var chart102OneYrGooglized = google.visualization.arrayToDataTable(chart102OneYr.getChartArray());
        // Instantiate and draw the chart, passing in global options.
        var googleChart102OneYr = new google.visualization.ComboChart($('#metric102ChartOneYr')[0]);
        google.visualization.events.addListener(googleChart102OneYr, 'ready', placeOverlay.bind(googleChart102OneYr, chart102OneYrGooglized, chart102OneYr));
        googleChart102OneYr.draw(chart102OneYrGooglized, globalChartOptions);

Thank you for any clarification on which links should be used.

Daniel LaLiberte

unread,
Dec 14, 2015, 4:20:38 PM12/14/15
to Google Visualization API
KT,

We are actually transitioning the docs to use the gstatic loader, for a couple reasons.  Each example should be consistent with itself, though you will see two different ways in various places until we are finished doing the conversion.   See the documentation about loading frozen versions at: https://developers.google.com/chart/interactive/docs/basic_load_libs#frozen-versions


--
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 post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3a8dac90-3057-4582-a887-6d8dd0c5c20f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

KT

unread,
Dec 14, 2015, 4:36:52 PM12/14/15
to Google Visualization API
Ok, that is what I was wondering.  So I should use the 1's in my original description together, or the 2's.  Will the visualization syntax change soon as well?  i.e. 
  • google.visualization.arrayToDataTable, 
  • google.visualization.ComboChart, 
  • google.visualization.events.
If so, how soon and when will the documentation be there?

Also, I forgot - I'm using ComboCharts, not Area charts.  Not sure if there is anything to be aware of there.

Is it recommended to use the frozen method to ensure my site will be stable?  How do I know which version is currently in place?


On Monday, December 14, 2015 at 4:20:38 PM UTC-5, Daniel LaLiberte wrote:
KT,

We are actually transitioning the docs to use the gstatic loader, for a couple reasons.  Each example should be consistent with itself, though you will see two different ways in various places until we are finished doing the conversion.   See the documentation about loading frozen versions at: https://developers.google.com/chart/interactive/docs/basic_load_libs#frozen-versions

On Mon, Dec 14, 2015 at 4:12 PM, KT <bloodho...@gmail.com> wrote:
I am confused as to which link I am supposed to use.  The main Quick Start page shows one link, yet the individual charts documentation show another.

Within the html file:
  1. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  2. <script type="text/javascript" src="https://www.google.com/jsapi"></script>

I also see two different load links and am confused as to which should be used, within my js functions.
  1. google.charts.load('current', {packages: ['corechart']});
  2. google.load('visualization', '1', {'packages':['corechart']});

I am creating and displaying Area charts:

        var chart102OneYrGooglized = google.visualization.arrayToDataTable(chart102OneYr.getChartArray());
        // Instantiate and draw the chart, passing in global options.
        var googleChart102OneYr = new google.visualization.ComboChart($('#metric102ChartOneYr')[0]);
        google.visualization.events.addListener(googleChart102OneYr, 'ready', placeOverlay.bind(googleChart102OneYr, chart102OneYrGooglized, chart102OneYr));
        googleChart102OneYr.draw(chart102OneYrGooglized, globalChartOptions);

Thank you for any clarification on which links should be used.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.



--

Daniel LaLiberte

unread,
Dec 15, 2015, 8:10:49 AM12/15/15
to Google Visualization API
The Google Charts API for the charts and data will not be changing just because we are changing how the library is loaded.  Going forward, it would be better to use the gstatic loader if you can, and for most people, there is no reason not to.  There are a couple deficiencies we are still working on, regarding dynamic loading.

I'm not sure about the timeline for transitioning the documentation, but I would expect it will be done within a month.

If you are concerned about stability and happy with a particular version, then you may want to use that frozen version, but the disadvantage, of course, is that you will not see updates that could improve your chart.


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--

Jose Manuel Silva Vela

unread,
Jan 26, 2016, 10:46:13 AM1/26/16
to Google Visualization API
Hello Daniel, the new API is great, I really like the way you can pull either the current version or frozen versions, it's very interesting.

We are working on integrating Google Charts into multiple divs on a single page. We have no way to know beforehand which visualizations users will want to see on a given page, therefore it's not possible for us to predict all the packages additional to corecharts that we need to pass when calling google.charts.load('current',{packages:['corechart']});

We found that if we use google.load('visualization', '1', {'packages':['corechart']}); instead of google.charts.load('current', {packages: ['corechart']}); it seems that it is possible to fetch the different packages incrementally without getting the error of reloading google charts.

Can you confirm whether there is a way to use google.load to fetch the current version similar to google.charts.load ? Is it on your roadmap to support fetching incrementally the different packages by being able to call google.charts.load several times? If so, do you have any timeframe of when that will be happening?

Thanks and keep up the great work.

Jose Manuel
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.



--

Daniel LaLiberte

unread,
Jan 26, 2016, 11:32:29 AM1/26/16
to Google Visualization API
Jose,

The new loader doesn't support the incremental loading of more packages yet, though I have a change in the works to implement that.  I'm not sure when I'll be able to finish it off, but as soon as possible.

Until I finish that, if you really need to load alternate packages in the same page, it might work to remove all of google.charts and google.visualization, and then load the loader again and call google.charts.loader again.  No guarantees, and it is rather more expensive than necessary, but it might work.

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.



--

--
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 post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages