plotly / plotly/plotly.R

Tooltip along the length of a segment

Abierto
#1,832 2 comentarios 0 reacciones 0 asignados Ver en GitHub

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.

demonstration of the problem


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")

demonstration of problem work-around

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. 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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.