Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Chrome and Loading of Visualizations #98

Open
photomedia opened this issue Jun 18, 2020 · 1 comment
Open

Google Chrome and Loading of Visualizations #98

photomedia opened this issue Jun 18, 2020 · 1 comment

Comments

@photomedia
Copy link

I’ve been trying to track down a problem with loading of download summary table visualization on abstract pages and I can’t seem to figure it out.
The problem only seems to appear in Google Chrome, on Firefox and Edge all is well.
On Chrome, however, the graph visualizations don’t appear on the abstract pages, most of the time. Clicking on “Reload” will make it appear every now and again, so the issue is intermittent to some extent; but mostly the loader just keeps spinning and it doesn’t appear.
I have tried to track down the issue, and as far as I see, the XHR call to getData works fine, and data is returned without problems, and passed to the correct functions.
The problem appears right at this line:

               var data = new google.visualization.DataTable();

line (263):

var data = new google.visualization.DataTable();

the call to new google.visulization.DataTable() in EPJS_Stats_GoogleGraph = Class.create(EPJS_Stats,

When I put a “Break” (in the debugger in the browser) on this line, I see that it is reached, and the retrieved data (about downloads) is there in the function, but the browser almost never comes back from this line and reaches no subsequent break points. Sometimes it does come back, reaches the next line, and then stops, and then sometimes, it does keep going to the end and then the graph does display. I tried experimenting with how Google Charts / JSAPI is included/loaded, the version number of the library, but nothing seems to fix it.

@photomedia
Copy link
Author

I was able to fix this by changing/updating how visualizations are loaded.

New code in 90_irstats2.js looks like this for corechart:

google.charts.load("visualization", "48", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);

and like this for geochart:

google.charts.load("visualization", "48", {packages:["geochart"]});
google.charts.setOnLoadCallback(drawChart);

That solves the loading issue in Chrome. It also surfaced the warning from the JavaScript API that the GeoChart requires a Maps API key:

image

The Map visualization (for Origin of Downloads report) still shows up, for the time being, but this warning means that Google will probably keep up the pressure for us to get an API key (which now requires a method of payment/account on their cloud platform).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant