Skip to content

Google Chart loader callback not working, which may point to something deeper with us #1759

@rickmcgeer

Description

@rickmcgeer

What would you like to achieve?
What Google recommends to load chart packages is

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

followed by

google.charts.load('50', { packages: packageList, mapsApiKey: 'AIzaSyA4uHMmgrSNycQGwdF3PSkbuNW49BAwN1I' });
google.charts.setOnLoadCallback(finishLoad); // or whatever function

Now, the problem is, in Lively, the calllback function never gets called. I tried a bunch of things -- attaching the callback to window, passing an anonymous function, but nothing worked. Eventually I settled on a polling solution (every 100ms checking on whether google.visualization was non-null). That worked, but, boy, what a kludge.
Now, it could well be that this is a Google bug. It wouldn't be the first or last time. But just in case it's something in Lively I thought I would pass it along.
The code is here:

$world.execCommand("open browser", {moduleName: "studio/index.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "main"});

For development in the IDE I call loadVisScript by hand. In production, I added the script tag in the world's HTML header:

$world.execCommand("open browser", {moduleName: "studio/ui.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "GalyleoStudioWorld"});

How are you trying to achieve that

Alternative solutions
If applicable, what other solutions have you tried?

Additional Resources
Please provide links to any custom code that might be necessary to grasp your problem. Screenshots of custom component, etc. are also appreciated.

Version: Please paste the lively.next commit on which the problem occurred here (use the copy button of the Version Checker in the bottom left corner).
c725a77

Metadata

Metadata

Assignees

No one assigned

    Labels

    📟 support inquiryQuestions that can be answered without changing code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions