plotly / plotly/plotly.R

FR: Add support for plotly_sunburstclick and plotly_treemapclick in highlight()

Offen
#2,176 0 Kommentare 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

As sunburst/treemap charts have their own click-events: plotly_sunburstclick / plotly_treemapclick it would be nice to support them in highlight.

The following (plotly_click) doesn't work as expected:

library(plotly)
library(crosstalk)

sunburstDF <- structure(list(labels = structure(c(1L, 3L, 4L, 2L, 7L, 6L, 5L, 
7L, 6L, 5L, 7L, 6L, 5L), levels = c("Total", "mixed", "private", 
"public", "commercial", "recreation", "residential"), class = "factor"), 
    values = c(1658, 353, 1120, 185, 108, 143, 102, 300, 320, 
    500, 37, 58, 90), parents = c(NA, "Total", "Total", "Total", 
    "Total - private", "Total - private", "Total - private", 
    "Total - public", "Total - public", "Total - public", "Total - mixed", 
    "Total - mixed", "Total - mixed"), ids = c("Total", "Total - private", 
    "Total - public", "Total - mixed", "Total - private - residential", 
    "Total - private - recreation", "Total - private - commercial", 
    "Total - public - residential", "Total - public - recreation", 
    "Total - public - commercial", "Total - mixed - residential", 
    "Total - mixed - recreation", "Total - mixed - commercial"
    )), row.names = c(NA, -13L), class = "data.frame")


d <- highlight_key(sunburstDF, ~ids)
fig <- plot_ly(data = d, ids = ~ids, labels= ~labels, parents = ~parents, values= ~values, type='sunburst', branchvalues = 'total')
fig1 <- fig2 <- highlight(fig, on = "plotly_click", off = "plotly_doubleclick", dynamic = FALSE)
crosstalk::bscols(fig1, fig2)

Related: allow plotly_unhover as an off event: https://github.com/plotly/plotly.R/issues/1864

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 damit nachzuverfolgen, wie highlight() die Ereignisnamen plotly_click und plotly_doubleclick behandelt, und vergleiche dieses Verhalten anschließend mit dem bereitgestellten sunburst- und treemap-Beispiel. Überprüfe, ob die crosstalk-Ansichten auf plotly_sunburstclick und plotly_treemapclick reagieren, während das bestehende highlight-Verhalten erhalten bleibt; das Issue nennt außerdem plotly_unhover als verwandte off-event-Anfrage.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Feature
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.