Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Programmatically reset the (brushed) state of a plot? #196

Open
lianos opened this issue Jan 25, 2017 · 1 comment
Open

Programmatically reset the (brushed) state of a plot? #196

lianos opened this issue Jan 25, 2017 · 1 comment

Comments

@lianos
Copy link

lianos commented Jan 25, 2017

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?

@hafen
Copy link
Collaborator

hafen commented Feb 17, 2017

Looking into this...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants