I have started seeing intermittent problems using Google Visualisation in a
customer's Production environment in the last few weeks. I have made no
code or infratructure changes.
The system has been stable for 3+ years, and I cannot replicate in a
development environment.
The browser being used is Chrome.
When trying to call
google.charts.load('current', { 'packages': ['corechart'] });
I intermittently see:
Uncaught TypeError: Cannot read property 'load' of undefined
at initialise()
The simplified replication code is:
<html>
<head>
<script type="text/javascript" src="scripts/jquery-3.3.1.min.js"></script>
<script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body>
<div id="chart">
</div>
function initialise() {
google.charts.load('current', { 'packages': ['corechart'] });
google.charts.setOnLoadCallback(() => {
// .. drawing code
};
}
$(function () {
$('#div').load ('Content/Chart.html', function() { initialise();});
});
</body>
</html>
Unfortunately I do not currently have details of the HTTP response for the
request to 'loader.js', but I errors in the Console have not been reported,
except the TypeError shown above.
My questions are:
1. Is there some sort of rate limiting/throttling applied to the
'loader.js' which might be causing this problem - the Production
environment has 1,000s of users.
2. Is it possible the customer's network is slow, meaning the
"initialise" code is being called before all the JS has loaded?
(I thought that using $(function () {}); would mean the code wouldn't be
called before the entire page had finished loading?)
--
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 [email protected].
To post to this group, send email to [email protected].
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/46243bf7-52bc-450b-bab7-49ba72f6128c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.