Adding layers makes tooltips disappear
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 18.3k
- Fork
- 2k
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Descrizione
Hi there,
I'm experiencing the same issue as @borenstein, referenced here: Adding layer makes tool tips disappear. Someone asked @borenstein to post the issue here but I didn't see a record of it. Here's a shorter reproducible example and summary; please note their solution (comparing data on hover) doesn't work in my use case (not shown here).
I want to create a plot where users can hover over a map and a tooltip for a single layer appears, for example, showing the names of US counties, with state boundaries overlaid on the map. If your mouse is "far" from a state boundary, the tooltip appears. However, if you are "close" (e.g., southeastern edge of map), the tooltip does not appear.
I've tried identifying the traces that contain parts of my plot that I don't want to show tooltips for - as in these stack overflow posts:
-
ggplotly - only return tooltip hover text on certain geom objects
-
Disable hover information for a specific layer (geom) of plotly
But, it doesn't work.
library(plotly)
library(tidyverse)
### New England: *sometimes* shows tool tips
new_england <- c("maine", "new hampshire", "vermont", "massachusetts", "connecticut", "rhode island")
b <- ggplot2::map_data("state") %>%
filter(region %in% new_england)
a <- data.frame(group = seq(3085), val = rnorm(3085)) %>%
left_join(ggplot2::map_data("county"), by = "group") %>%
filter(region %in% new_england)
p <- ggplot(a, aes(long, lat, group = group)) +
geom_polygon(aes(fill = val, text = subregion)) +
geom_path(data = b, color = "black")
ggplotly(p, tooltip="text")
Tagging @MountainCedar so they know I've filed an issue about this.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo l’esempio riproducibile ggplotly fornito e confronta il comportamento degli hover vicino e lontano dal confine dello stato. Analizza come le trace di poligoni e percorsi sovrapposte gestiscono la selezione dei tooltip; il lavoro è completo quando i tooltip con i nomi delle contee rimangono disponibili vicino ai confini senza richiedere il workaround proposto. Nell’issue non sono indicati file o test, quindi individuare il codice di hover pertinente e aggiungere una copertura di regressione richiederà familiarità con il progetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100