bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 67 forks source link

dynamically adjust figure from server side #210

Open tr8dr opened 7 years ago

tr8dr commented 7 years ago

First wanted to say thanks for putting this package together. rbokeh has a better API (IMO) than the python version.

The python version of the bokeh library has a special server mode, allowing dynamic update of figures. rbokeh integrates with shiny (which is great). Based on what I've seen, however, shiny <-> bokeh is regenerating the graph on each adjustments. For fairly complex renders this may be prohibitively slow and visually disruptive.

From prior experience with bokeh server, I believe many of the bokeh figure, dataset, and glyphs can be changed from the server (python side) and this is then reflected on the browser. Is there a means of making dynamic adjustments server side without re-rendering?

hafen commented 7 years ago

Thanks! You're right that the current paradigm for using a server with rbokeh is to use Shiny, but you're also right that the support is a bit lacking in that you currently can't update aspects of a figure without re-rendering the whole thing. One reason for this is that when I first wrote rbokeh, there was a lot of stuff that needed to be handled in R like mapping data values to various plot attributes and it is really messy to think of how to update a plot in the browser when it has to pass through some ugly mapping going on in R. These things can now be handled in the browser with BokehJS, so bringing things more up to date with that will help get there.

I'm working on some major internal overhauls of rbokeh that should bring its model representation fully in line with Bokeh such that it should be easier to do these things and hopefully even interface with Bokeh server as an option as well. This is at least a couple of months off though.

tr8dr commented 7 years ago

thanks, good to hear. I would be happy to help with the dynamic capabilties when you'll remapped your model. I don't yet know enough about the protocol between BokehJS and server side, though see that the interaction is via creation and manipulation of objects instantiated through a json-based protocol .

Suspect that shiny's current model may be too restrictive for dynamic interaction, as the output functions, when triggered, regenerate the content for a given div. Perhaps will need to extend shiny to provide a variation of the event -> action interface so that an arbitrary action can be attached to a change in input. There may be a facility for this already that have missed, however.