plotly / plotly/plotly.R

highlight() function: setting the 'off' event to 'plotly_unhover' results in an error.

Ouverte
#1,864 3 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

This is a modified example from here:

library(plotly)

# load the `txhousing` dataset
data(txhousing, package = "ggplot2")

# declare `city` as the SQL 'query by' column
tx <- highlight_key(txhousing, ~city)

# initiate a plotly object
base <- plot_ly(tx, color = I("black")) %>% 
  group_by(city)

# create a time series of median house price
time_series <- base %>%
  group_by(city) %>%
  add_lines(x = ~date, y = ~median)

highlight(
  time_series, 
  on = "plotly_hover",
  off = "plotly_hover", # causes error
  selectize = FALSE, 
  dynamic = FALSE,
  color = "red",
  persistent = FALSE
)

Not providing off results in a warning:

Setting the off event (i.e., 'plotly_doubleclick') to match the on event (i.e., 'plotly_hover'). You can change this default via the highlight() function.

Setting off to plotly_hover or plotly_unhover (my initial intention) results in an error:

Error in match.arg(off, off_options) :
'arg' should be one of “plotly_doubleclick”, “plotly_deselect”, “plotly_relayout”

Found this via: https://stackoverflow.com/a/64387370/9841389

PS: using the latest CRAN version of plotly.

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 au point d’entrée highlight() et reproduisez l’exemple txhousing modifié avec off défini sur plotly_hover et plotly_unhover. Examinez la validation de off_options et comparez-la au comportement documenté des événements ; le travail est considéré comme terminé lorsque les événements off valides ne déclenchent plus l’erreur match.arg signalée et que l’exemple se comporte comme prévu.

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

Évaluation

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

Recevez les nouvelles issues par e-mail

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