plotly / plotly/plotly.R

Shiny plotly sizing issue for plotlyOutput() when width = 100%

Abierto
#1,827 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
R
Estrellas
2.7k
Forks
641
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

When using the default width = 100% for plotlyOutput() in Shiny apps, I always run into issues where the width doesn't scale to the full width when clicking away before the plot is fully rendered. When clicking back, the plot's width doesn't adjust or rescale. This setting occurs often in practice when designing a shinydashboard with multiple tabItems(). Minimal example and a GIF to better explain what I mean below. Posting it here, but please advise if this should be an htmlwidgets or shiny issue instead.

plotlyOutput

library(shiny)
library(plotly)

ui <- navbarPage(
  title = "Minimal Example",
  tabPanel("Home", HTML("Click the `Plot` tab and then rapidly back on the `Home` tab. Wait 2 seconds and then click the `Plot` tab again.")),
  tabPanel("Plot", plotlyOutput("plot"))
)

server <- function(input, output) {
  output$plot <- renderPlotly({
    Sys.sleep(2)
    plot_ly(iris, x = ~Sepal.Width, y = ~Sepal.Length, type = "scatter", mode = "markers")
  })
}

shinyApp(ui, server)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza ejecutando el ejemplo mínimo de R Shiny proporcionado y reproduciendo el comportamiento al cambiar de pestaña con plotlyOutput() y renderPlotly(). Investiga si el problema de dimensionamiento corresponde a plotly.R, htmlwidgets o Shiny; se considera terminado cuando el gráfico se expande al ancho completo después de volver a su pestaña, incluso cuando el renderizado se retrasó.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
plotly, r
Área
data-visualization, frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.