google.charts.load error since this morning

2,496 views
Skip to first unread message

Julian Hullis

unread,
Jun 7, 2017, 6:43:00 AM6/7/17
to Google Visualization API
Hi,

I've started getting the following error across all applications using the charts api.

'Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback at Object.google.G.K.T.jl [as setOnLoadCallback] (loader.js:224)'.

This includes a published app (hosted internally) that hasn't been updated for two weeks.

Has there been an update to the api in the last 12 hours that could be causing this?

Thank you.



google.charts.setOnLoadCallback(function () {
    angular.bootstrap(document.body, ['opsRiskApp']);
});

google.charts.load('43', { packages: ['corechart'] });


Daniel LaLiberte

unread,
Jun 7, 2017, 11:53:20 AM6/7/17
to Google Visualization API
Yes, this was the planned update of the loader announced last week.  Not enough people tested it, apparently.

This particular error is, I believe, a legitimate error message caused by calling google.charts.setOnLoadCallback before calling google.charts.load.  It is documented that the order should be the other way around.  I hope it will be easy enough for people to fix. 

--
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-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@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/7d910b9b-9d1b-4d71-a729-19cf454971aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Daniel LaLiberte

unread,
Jun 7, 2017, 5:27:40 PM6/7/17
to Google Visualization API
I could make another special check for the case when the first setOnLoadCallback call occurs before the first load call.  I think this is a bad practice, however, which becomes more clear when you consider what happens when there is more than one load call.  Any calls of setOnLoadCallback that occur after the first load call will call the callback immediately after the first load is done, even if the intention is to wait for yet another load call to be done.

So I am curious if there is a legitimate need to call setOnLoadCallback before the first load.  If there is, I might be motivated to add this special check. 

On Wed, Jun 7, 2017 at 11:53 AM, Daniel LaLiberte <dlali...@google.com> wrote:
Yes, this was the planned update of the loader announced last week.  Not enough people tested it, apparently.

This particular error is, I believe, a legitimate error message caused by calling google.charts.setOnLoadCallback before calling google.charts.load.  It is documented that the order should be the other way around.  I hope it will be easy enough for people to fix. 
On Wed, Jun 7, 2017 at 6:43 AM, Julian Hullis <julian...@gmail.com> wrote:
Hi,

I've started getting the following error across all applications using the charts api.

'Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback at Object.google.G.K.T.jl [as setOnLoadCallback] (loader.js:224)'.

This includes a published app (hosted internally) that hasn't been updated for two weeks.

Has there been an update to the api in the last 12 hours that could be causing this?

Thank you.



google.charts.setOnLoadCallback(function () {
    angular.bootstrap(document.body, ['opsRiskApp']);
});

google.charts.load('43', { packages: ['corechart'] });


--
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-visualization-api+unsubscr...@googlegroups.com.
--

Iain Gray

unread,
Jun 8, 2017, 5:06:52 AM6/8/17
to Google Visualization API
Yes I am in the same boat (though a very inexperienced js developer - I simply followed the docs.

All my charts are working fine as I do have setOnLoadCallback after load, except the page that has 2 charts - 1 table and 1 timeline:
 
<script type="text/javascript">
    google.load('visualization', '1.0',{'packages':['timeline', 'table']});
    google.setOnLoadCallback(drawChart);
    google.charts.setOnLoadCallback(drawTable);

This fails as of this morning

Daniel LaLiberte

unread,
Jun 8, 2017, 8:55:17 AM6/8/17
to Google Visualization API
Hi Iain,

You appear to be trying to use both the old loader and new loader at the same time.  That is bound to fail since incompatible code will be loaded by each.

So, I would recommend you only use the new loader.  Change your google.load and google.setOnLoadCallback calls to google.charts.load and google.charts.setOnLoadCallback.  See the instructions here:  https://developers.google.com/chart/interactive/docs/basic_load_libs#update-library-loader-code

--
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-visualization-api+unsub...@googlegroups.com.

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

Iain Gray

unread,
Jun 8, 2017, 9:35:10 AM6/8/17
to Google Visualization API
Many thanks that work now. Thing is it has worked like that wrong way for the last 2 months, but I guess the new release exposed the error.

Like I say I am not a js coder - just s copy-paster

Thanks again
To post to this group, send email to google-visua...@googlegroups.com.



--
Reply all
Reply to author
Forward
0 new messages