Bug with hoverOpts, clip=TRUE
Open
@tmastny is already working on this.
Since Jun 14, 2018.
Difficulty: Novice
Effort: Low
Priority: Low
Type: Bug :bug:
- Dominant language
- R
- Stars
- 5.7k
- Forks
- 1.9k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 2
Description
I’m having some trouble getting the clip=FALSE argument to have any effect on the hover for a plot. As soon as the cursor leaves the plotting area, but is still within the plot image, the hover input goes to NULL, whether or not clip is set to TRUE or FALSE. I’ve attached a reproducible example and an online version from shinyapps.io. (This issue also seems to be the same for clickOpts)
app.R:
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
textOutput("hoverText")
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot",hover=hoverOpts("dist_hover",nullOutside=FALSE))
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$hoverText <- renderText({
print(input$dist_hover)
paste0("x: ",input$dist_hover$x,"y: ",input$dist_hover$y)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.