plotly / plotly/plotly.R

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

Ouverte
#2,176 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
R
Étoiles
2.7k
Forks
641
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par retracer la façon dont highlight() gère les noms d’événements plotly_click et plotly_doubleclick, puis comparez ce comportement avec l’exemple sunburst et treemap fourni. Vérifiez que les vues crosstalk réagissent à plotly_sunburstclick et plotly_treemapclick, tout en conservant le comportement existant de highlight ; l’issue identifie également plotly_unhover comme une demande connexe d’off-event.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
r
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.