Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Access persistent click/hover data in shiny, addresses #1401 #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cpsievert wants to merge 1 commit into master
base: master
Choose a base branch
Loading
from persistent-click-hover-shiny

Conversation

Copy link
Collaborator

@cpsievert cpsievert commented Nov 15, 2018
edited
Loading

See #1401 for more context

Review questions

  • Is it safe to remember event data by attaching an attribute to graphDiv in this way? Should try this out in conjunction with plotlyProxy().
  • Should we worry about emitting redundant data in the persistent case? Or should this be the responsibility of the user?
  • Should we worry that the persistent hover data isn't cleared when unhovering after a shift?

Testing notes

Install (devtools::install_github("ropensci/plotly#1409")), run this app, and make sure the event data is what you'd expect.

library(shiny)
library(plotly)
ui <- fluidPage(
 plotlyOutput("plot"),
 verbatimTextOutput("click"),
 verbatimTextOutput("shift_click"),
 verbatimTextOutput("hover"),
 verbatimTextOutput("shift_hover")
)
server <- function(input, output, session) {
 output$plot <- renderPlotly({
 plot_ly(x = 1:10, y = 1:10, key = LETTERS[1:10])
 })
 
 output$click <- renderPrint({
 d <- event_data("plotly_click")
 if (is.null(d)) "Transient click data" else d
 })
 output$shift_click <- renderPrint({
 d <- event_data("plotly_click_persist_on_shift")
 if (is.null(d)) "Persistent click data" else d
 })
 output$hover <- renderPrint({
 d <- event_data("plotly_hover")
 if (is.null(d)) "Transient hover data" else d
 })
 output$shift_hover <- renderPrint({
 d <- event_data("plotly_hover_persist_on_shift")
 if (is.null(d)) "Persistent hover data" else d
 })
}
shinyApp(ui, server)

YsoSirius and trafficonese reacted with thumbs up emoji
Copy link

Shouldn't a doubleclick clear the Shift selections?
Now the selection is only cleared, by clicking a new point/bar.

It also doesnt always reflect the highlighted elements, as Shift must be pressed already when clicking the first element. The "usual" behaviour would be to click the first without Shift and then to add more into the selection, hold Shift and click another point which will be added to the current selection.

The Box/Lasso-selection behave like the "usual" way.

Otherwise nice work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /