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

require.js load plotly timeout #7

Open
iynehz opened this issue May 2, 2019 · 3 comments
Open

require.js load plotly timeout #7

iynehz opened this issue May 2, 2019 · 3 comments

Comments

@iynehz
Copy link

iynehz commented May 2, 2019

I sometimes get this error in my browser.

Uncaught Error: Load timeout for modules: plotly
http://requirejs.org/docs/errors.html#timeout

I guess it's about this https://metacpan.org/release/Devel-IPerl-Plugin-Chart-Plotly/source/lib/Devel/IPerl/Plugin/Chart/Plotly.pm#L20, but not sure what the problem is. Running Chart::Plotly without Jupyter Notebook is all good.

Many Python Jupyter Notebook extensions are in a "nbextension" form, and you can run jupyter nbextensions install/enable ... to install it, and if there are js files they will be installed into ~/.local/share/jupyter/nbextensions/$extension/ and be hosted by the Jupyter Notebook service. I wonder if we can do similar thing for this plugin...

I just remember that Python plotly package can be used in offline mode in Jupyter Notebook: https://plot.ly/python/offline So we probably can see how that's implemented and we might take the same approach as recent Chart::Plotly has been shipping plotly.js.min.

@iynehz
Copy link
Author

iynehz commented May 3, 2019

Python's plotly package, depends on whether user provides "connected" or not, either requires plotlyjs from the CDN, or embeds its local source into the notebook. See,
https://github.com/plotly/plotly.py/blob/eeb0ac47892c97c6cd6c95ff23d22000f451b4f2/plotly/io/_base_renderers.py#L256
https://github.com/plotly/plotly.py/blob/eeb0ac47892c97c6cd6c95ff23d22000f451b4f2/plotly/io/_base_renderers.py#L277

R‘s plotly exports the plot to an html file (with plotlyjs source embeded as R plotly is by default in offline mode), and embeds the html file into the notebook via iframe. https://github.com/ropensci/plotly/blob/a76100d7c06774ec50c07982ff6bfdb6d2d09e2d/R/embed.R#L34

It looks to me that the Python plotly's approach is better. But I looked at IPerl's load_plugin() method and it does not support arguments. It might be best to get IPerl's load_plugin to support arguments, but that would involve @zmughal who seems to be not that active on his older projects today. @pablrod do you think it's fine for your plugin to embed plotlyjs source like Python's connected=False case? If so I can create a P/R.

@pablrod
Copy link
Owner

pablrod commented May 4, 2019

I'm not able to reproduce the problem, but I think it's fine to use the offline case as the default.

@pablrod pablrod added the bug label May 4, 2019
@iynehz
Copy link
Author

iynehz commented May 5, 2019

It's not a bug. I am not 100% sure but it could be just that ISP service in China is not stable...

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

2 participants