Open smartinsightsfromdata opened 8 years ago
Ok there's two separate issues here so let me address them in turn:
rCharts
definitely works, but IRdisplay
is part of the Jupyter R package, so that isn't available. To get rCharts
html output inline with rZeppelin, you need to tell rCharts
to produce inline HTML output. Here is an example:%spark.knitr results='asis',echo=F,warning=F,message=F
require(rCharts)
data(economics, package = 'ggplot2')
econ <- transform(economics, date = as.character(date))
m1 <- mPlot(x = 'date', y = c('psavert', 'uempmed'), type = 'Line',
data = econ)
m1$set(pointSize = 0, lineWidth = 1)
m1$show('inline',include_assets=TRUE, cdn=TRUE)
Note a couple of key things -- results are set to 'asis', and the plot is displayed with $show
with particular parameters.
This example is from the demo notebook. That was included before, but isn't in the current version that's pending merge into zeppelin. So the instructions for doing this should probably get added to the manual
htmlwidgets
package uses js and css files with indirect dependencies. rmarkdown
handles this by passing them through pandoc
, which bundles those dependencies into the same HTML file. I've exchanged messages with @ramnathv about this, and spent considerable time trying to develop an R or scala implementation to handle the dependencies. It turns out to be highly non-trivial. If you can suggest an acceptably-licensed R or java/scala library that can handle it, I'll write the code to bridge them together.
I'm going to leave this issue open for a few days in case you run into any problems with rCharts
@elbamos here is one thought. if widget authors can also provide standalone versions of assets (pre-run through pandoc), then it is fairly trivial to write a dependency bundler in R that inlines all assets. The question is will widget authors be willing to add extra assets to their packages?
I tried charting with Leaflet.js in rCharts and with RStudio leaflet library, with no success with either.
Would you be so kind to post an example that works?
Also, have you tried Zeppelin with any htmlwidgets? Do they work? (the method used below, of saving a file and displaying it as iframe was originally proposed by RamnathV as stop gap for jupyter with R kernel - it doesn't work with all htmlwidgets though).
Leaflet The following works with the jupyter notebook and R kernel, but it does not work with Zeppelin R:
rCharts I tried to display the classic example below, but the chart is displayed on another tab as index.html (on Safari).