WebSharper.Google.Visualization is pretty outdated, and unlike a good binding it's using a non-versioned base URL as a reference (see here in the sources), making it susceptible to breaking on API changes.

A quick fix would be to override this base URL with an older library reference that the binding was made for, using an app setting in your config file. But I somehow doubt such URL exists.

The other option is to update the binding itself. Fixing the change in the underlying package loading mechanism you pointed out should be pretty straightforward (in or around the lines in the link above, and feel free to submit a PR for it), but making a FULL binging to the current capabilities would need a thorough combing through and probably a lot of API changes/additions to address. (The current binding is several years old AFAIK.)

By on 6/25/2020 6:00 AM ()

With further investigation it appears the old load method is now being redirected to the new functionality. The new method is not initialising google.visualization until later, but this is mapped at the beginning of the site script.

 google=Global.google; // initialised
 visualization=google&&google.visualization; // undefined
 events=visualization&&visualization.events; // undefined

As a workaround, I defined these with new objects before the other scripts load.

    <script type="text/javascript">
        if (window.google === undefined)
            window.google = new Object();
        if (google.visualization === undefined)
            google.visualization = new Object();
        if (google.visualization.events === undefined)
            google.visualization.events = new Object();

Locally, I have also updated the visualization binding to the new library calls. I could also incorporate the pre-initialisation, unless there is a better way to resolve it.

By on 6/25/2020 10:41 PM ()

You mean you have a full local binding to the current library?

By on 6/26/2020 8:32 AM ()

Finally found some time to create a pull request. https://github.com/dotnet-websharper/google.visualization/pull/1

By on 8/5/2020 12:26 AM ()

I updated the load call to use the new library and select version 45.2 by default, which is the last version that was provided to the old load method. This reduces the need to check and revise the rest of the binding. I added settings for the version to load and to provide a Google Maps API key. I also needed to wait for the onLoad callback before using the library in the test samples. When I have time, I'll submit a pull request.

By on 6/29/2020 5:21 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper