Tooltip along the length of a segment
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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")

Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en el punto de entrada de R add_segments() y compáralo con la solución alternativa add_lines() mostrada en los ejemplos. Reproduce el comportamiento del hover en los extremos del segmento, en el centro y después de hacer zoom; se considera terminado cuando el tooltip de un segmento aparece a lo largo de toda su longitud sin requerir la solución alternativa.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- plotly, r
- Área
- data-visualization
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100