-
Notifications
You must be signed in to change notification settings - Fork 141
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
support htmlwidgets in RCloud? #1435
Comments
Related links: htmlwidgets/Zeppelin: ramnathv/htmlwidgets#146 |
It looks like htmlwidgets is currently an rmarkdown-only solution, a standard which is documented on the client side but not the server side. |
Of course, we can use rmarkdown and do support rmarkdown cells, so maybe that is a solution here. The main complaint in the Zeppelin thread is that pandoc is slow, but I don't think that is a serious issue for us. |
This thread is also relevant: ramnathv/htmlwidgets#86 |
First working version: MangoTheCat@2a8d434 It uses iframes and the srcdoc attribute, which is good and bad. Good, because widgets are totally independent, no JS interference. Bad, because it does not work out of the box on IE. But there is a good polyfill: https://github.com/jugglinmike/srcdoc-polyfill |
Don't think IE support is a requirement, is it @gordonwoodhull? |
@shaneporter Nevertheless, the polyfill is really simple, so why not? |
Awesome, @gaborcsardi, please open a PR! I am a little disappointed over iframes since they don't integrate very well, but let's start there and see if we can improve it over time. I assume that's mostly because of JS library version conflicts? We don't currently support IE because it has "different" websocket "standards" (like pong messages), so that's not a concern right now. |
@gordonwoodhull Regarding iframes, it is mainly because of the simplicity. I can easily pull out a self-contained HTML page from The current approach is quite robust I think. Plus, as you mention, we also get rid of all JS library conflicts. IMO iframes integrate relatively well nowadays, although sizing might be an issue, that is not perfect yet. I need to read a bit about how But in any case, I can try to get rid of the iframes. |
@gordonwoodhull I am trying to make htmlwidgets work in mini.html. I was wondering what kind of API you would like. How about sg. like this: library(DT)
...
rcw.set("#mytable", htmlwidget(datatable(dataset)))
... and Actually, as I see it, if I implement an ...
rcw.set("#mytable", datatable(dataset))
... Is this OK? |
That looks great! Do you anticipate any ill side-effects of the Another possibility to consider (depending on time) is to implement a similar behavior to images, so that the user can resize the htmlwidgets inside the notebook or dashboard. @dougmet or @shaneporter can tell you about this functionality; it's used a lot in RCAP. This would probably require sending the data in its own ocap (see (Presumably exporting images would not work, since htmlwidgets usually depend on the JS side to produce content.) |
I think Just pushed it, it works great in mini.html. But I really need to do sg about the sizing now, it is probably even more important in mini.html. I know about the stretchy plots, let me do some research on how |
Note to myself: there is a detailed guide for html widget sizing: https://cran.r-project.org/web/packages/htmlwidgets/vignettes/develop_sizing.html Ideally we would need to capture resizing and pass it on to the widget, but I am not sure if this will be possible with the iframes. Probably not. If not, then I will try to get rid of the iframes tomorrow. |
Implemented in #2016, still with iframes but they are mostly invisible. |
We have some ad hoc support for the RStudio html ecosystem via shared.R and rcloud.shiny, but in a sense we went about this in a backwards way, watching what failed and patching it up.
Now there is htmlwidgets, which seems like it should be a nice standard for embedding HTML/JavaScript based visualizations into cells or rcloud.web applications.
I wonder how hard it would be to hook in at a deeper level and directly support this infrastructure.
The text was updated successfully, but these errors were encountered: