Skip to content
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

plotOutput isn't resized when using bindEvent #3590

Open
ismirsehregal opened this issue Feb 23, 2022 · 2 comments
Open

plotOutput isn't resized when using bindEvent #3590

ismirsehregal opened this issue Feb 23, 2022 · 2 comments

Comments

@ismirsehregal
Copy link
Contributor

ismirsehregal commented Feb 23, 2022

I'm wondering if it is expected behaviour or a bug, that base plots are no longer resized when using bindEvent even though using default width = "100%" (e.g. plotly plots are still getting resized - probably because they don't need to be re-rendered for resizing):

library(shiny)

ui <- fluidPage(
  plotOutput("goPlot", width = "100%"),
  actionButton("go", "Go")
)

server <- function(input, output, session) {
  output$goPlot <- renderPlot({
    plot(1:10)
  }) %>% bindEvent(input$go)
}

shinyApp(ui, server)

Animation

This is where I stumbled over the above. I wanted to replace eventReactive with bindEvent but the behaviour is not the same.

@dipterix
Copy link

To add to the issue, execOnResize in renderPlot does not work as well.

@ismirsehregal Before they fix this issue, I guess you can bind other events such as session$clientData[[sprintf('output_%s', session$ns("goPlot"))]] to monitor the width. However, this approach requires re-rendering the plot on resize. In some cases this could be slow.

@lckarssen
Copy link

Maybe helpful: issue #3876 has a couple of comments about how renderPlot and bindEvent work together (or not).

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

No branches or pull requests

3 participants