plotly / plotly/plotly.R

Chart width error with shiny tabpanels

Offen
#2,085 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,

When a plot is loading and at that moment you changes the tabpanel. When you return to the initial tab panel the width of the graph is incorrect.

We have tried all kinds of solutions such as putting the plots inside a column. But nothing works to fix the problem.

Using the following code, when starting the application and you changes to "Hello 2" before the graph of "Hello 1" has been rendered. The graph of "Hello 1" looks like in the following image

image

and not as in "Hello 2"

image

library(shiny)

`ui <- fluidPage(
selectInput("choice", "Choose", choices = names(iris), selected = NULL),
tabsetPanel(id="tabset",
tabPanel("Hello 1",value = "C1",
plotlyOutput("case1")),
tabPanel("Hello 2",value = "C2",
plotlyOutput("case2")) ))


server <- function(input, output) {

output$case1 <- renderPlotly({
    Sys.sleep(5)
    plot_ly(iris, x = ~get(input$choice), y = ~Sepal.Length, type = 'scatter', mode = 'markers')
})

output$case2 <- renderPlotly({
    Sys.sleep(5)
    plot_ly(iris, x = ~get(input$choice), y = ~Sepal.Length, type = 'scatter', mode = 'markers')
})

}

shinyApp(ui = ui, server = server)
`

Thanks.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der mitgelieferten minimalen Shiny-App und reproduziere das Problem, indem du die Tabs von tabsetPanel wechselst, bevor renderPlotly abgeschlossen ist. Verfolge, wie die Größenbestimmung von plotlyOutput gehandhabt wird, wenn der Tab wieder sichtbar wird; als erledigt gilt die Aufgabe, wenn beide Plots nach der Rückkehr zum ursprünglichen Tab wieder die korrekte Breite haben, mit einem Regressionstest für die Sequenz mit verzögerter Darstellung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization, frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.