rbokeh icon indicating copy to clipboard operation
rbokeh copied to clipboard

Programmatically reset the (brushed) state of a plot?

Open lianos opened this issue 8 years ago • 1 comments

This question pertains to the use of rbokeh within the context of a shiny application.

Is there a way to programmatically fire an event from the R side that would have the same affect as hitting the "Reset" button in an rbokeh plot's toolbar?

There are a few cases where I've found the need to do this. One of the (initially) more surprising ones is when you've got a plot on display that the user is interacting with, ie. has select a lasso-like tool and brushed an area of the plot.

Now imagine that the data that is being plotted is held in a reactive data frame. If the content of the data changes, this will trigger a re-execution of the rendering block, ie:

output$rbokeh_scatterplot <- renderRbokeh({
  req(data()) %>%
    figure() %>%
    ly_points(x, y)
})

It seems to me that the "region" that was previously brushed "sticks" and remains brushed after the redraw. In this example, I would like to call a function (or manually handcraft some javascript for now, until a function is made available) that ensures that the brush is obliterated (ie. equivalent of hitting the "reset" toolbar button) before the plot is redrawn.

Is this currently possible in anyway?

lianos avatar Jan 25 '17 20:01 lianos

Looking into this...

hafen avatar Feb 17 '17 08:02 hafen