plotly / plotly/plotly.R

config is not overwritting `ModeBarButtons` slot

Offen
#2,210 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

I have noticed that after placing a ModeBarButtons configuration, it is not overwritten / updated downstream.

Reproducible example:

library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
  # This plotly only has the `toImage` modeBarButton
  plot1 <- plot_ly() %>%
    config(displaylogo = FALSE) %>%
    config(modeBarButtons = list(list("toImage")))
  plot1$x$config$modeBarButtons
#> [[1]]
#> [[1]][[1]]
#> [1] "toImage"
  
  # This plotly also has the `toImage` modeBarButton only
  plot2 <- plot_ly() %>%
    config(displaylogo = FALSE) %>%
    config(modeBarButtons = list(list("toImage"))) %>% 
    config(modeBarButtons = list(list("zoom")))
  plot2$x$config$modeBarButtons
#> [[1]]
#> [[1]][[1]]
#> [1] "toImage"

Created on 2022-11-29 with reprex v2.0.2

This holds true for config(modeBarButtonsToAdd ...)

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 dem Einstiegspunkt config() und reproduziere die beiden Beispiele aus dem Issue, indem du plot1$x$config$modeBarButtons mit plot2$x$config$modeBarButtons vergleichst. Der Fix ist abgeschlossen, wenn eine spätere Konfiguration von modeBarButtons den früheren Wert aktualisiert und dasselbe Verhalten für modeBarButtonsToAdd verifiziert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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