-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IFrame issue: Can not integrate newest Plotly with GWT #5367
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
Comments
Interesting enough it seems like that So i digged a little further and it seems like this commit I have seen that |
We've discussed this - and the currently available workaround of creating a |
Thanks, didn't found the mentioned issues in my initial search. Yeah adding |
Hi,
I am unsure if you would consider it a bug, but at least for me it is a regression. I have been using very old Plotly 1.16.2 with GWT (gwtproject.org) just fine and thought about updating Plotly to 1.58.4. However when doing so, all charts are broken because Plotly 1.58.4 resets all layout configuration sections that are a plain javascript object, e.g. layout.xaxis.
The issue is that Plotly's
isPlainObject(obj)
method returnsfalse
because prototypes do not matchplotly.js/src/lib/is_plain_object.js
Line 24 in c12a797
But let me explain:
GWT is a Java to JavaScript compiler and kind of a framework to build JS apps using Java. The bootstrap mechanism of GWT apps put all the JavaScript code produced by GWT into its own iframe to not pollute the root window object. However the DOM tree of the app will be constructed in the root document and not within the iframe document. So only the GWT produced JS code lives inside the iframe.
Using GWT APIs I can load the JavaScript code of Plotly when needed and basically I have two choice:
When injecting Plotly into the root window, the above mentioned
isPlainObject()
method fails, since the Plotly configuration object is constructed from within the iframe by GWT code and thus have an object prototype originating from the iframe window.When injecting Plotly into the GWT iframe, the
isPlainObject()
method works correctly again since Plotly runs together with GWT code in the same iframe and prototypes now match as expected. However Plotly then seems to inject CSS (and some testing divs as well) into the iframe document. This results in unstyled charts in the GWT app, because the GWT app DOM tree is constructed in the root windows which does not know about the Plotly CSS in the iframe.Wondering what would be a good solution to make Plotly more compatible with GWT or in general with cross iframe / window usages.
The text was updated successfully, but these errors were encountered: