Tooltip along the length of a segment
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
I posted about this here in RStudio community in mid-June but didn't get any responses.
Edit Aug17: Stopped using x-unified hovermode, added new video to show the problem more clearly. Also posted another RStudio community post.
Maybe this feature exists, but I'm missing it? I would like to have a tooltip that extends across the entire length of a segment from add_segments().
Example:
library(plotly)
my_data <- data.frame(
x = c(1, 6), xend = c(5, 10),
y = c(1, 2), yend = c(1, 2),
text = c("First", "Second")
)
plot_ly(my_data, x = ~x, xend = ~xend, y = ~y, yend = ~yend,
text = ~text, hoverinfo = "text") %>%
add_segments()
This will put a tooltip at the beginning and the end of the segment, but users will tend to put their cursor near the middle of the segment and expect a tooltip to appear. Even more importantly, users won't get a tooltip if they are zoomed into the middle of a segment.

I've been getting around this problem by using add_lines() instead, but this is terribly inefficient when I'm trying to plot thousands of these segments at once, and it doesn't solve the zooming problem. E.g.
my_data <- data.frame(
x = c(seq(1, 5, length.out = 10), NA,
seq(6, 10, length.out = 10)),
y = c(rep(1, 10), NA,
rep(2, 10)),
text = c(rep("First", 10), NA,
rep("Second", 10))
)
plot_ly(my_data, x = ~x,y = ~y,
text = ~text, hoverinfo = "text") %>%
add_lines() %>%
layout(hovermode = "x unified")

Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le point d’entrée R add_segments() et comparez-le avec le contournement add_lines() présenté dans les exemples. Reproduisez le comportement au survol aux extrémités du segment, au milieu et après un zoom ; c’est terminé lorsque l’infobulle d’un segment apparaît sur toute sa longueur sans nécessiter le contournement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- plotly, r
- Domaine
- data-visualization
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100