Skip to content
Prev 14058 / 15075 Next

Rserve and plotly

Stavros,

htmlwidgets-based code essentially generates html code. In an interactive/local session such code is written into a file and that file is opened by user's browser to display. On a server that obviously doesn't make sense since the user is not on the server, so you have to decide how you want to make the resulting html pages available to the user. Normally, on a server one would use a web-based environment such as RCloud (based on Rserve) which automatically integrates htmlwidgets into the web output. Since you are creating a web-app a natural way is to do something similar.

Probably the easiest way to get started is to call saveWidget() to obtain a fully self-contained html file and serve it to the user. For more complex examples where you have multiple plots and need to take care of integration, serving of JavaScript dependencies etc. - you can have a look at https://github.com/att/rcloud.htmlwidgets for an example how this can be handled since you may need to merge and or/inject the different pieces.

Cheers,
Simon