Highlight of trace adds duplicate legend item.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, r
- Área
- data-visualization, frontend
Línea de trabajo
Comienza en inst/htmlwidgets/plotly.js, en la lógica de selección de crosstalk alrededor de las líneas 733 y 815. Reproduce la entrada de leyenda duplicada “Alpha” y luego rastrea cómo se añaden o se atenúan los traces seleccionados y no seleccionados, incluido el caso de selección parcial descrito en el issue. El trabajo estará terminado cuando el resaltado no cree entradas de leyenda duplicadas y se conserve la leyenda original cuando la selección cubra solo parte de un trace.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The current implementation for a selection highlighting adds duplicate legend entries.
For example in the below screenshot I clicked on trace "Alpha" and a new legend item "Alpha" got added while the existing "Alpha" legend is now dimmed but is still present. Resulting in 2 "Alpha" entries.
The core problem is that the current javascript code handling crosstalk selection, simply adds a duplicate selection traces here and dims all other traces here.
Since the original 'Alpha' trace was not removed and only dimmed and since a new trace also named "Alpha" was added to the legend. It results in the above legend.
Would it be possible to update the javascript logic to just dim the non-selected traces and update the selected trace to the desired highlight color (and other aspects set by the user). This would the have the desired effect on the legend.
Or to set the selected trace with showLegend=FALSE in the restyle for all the traces that got highlighted?
Edit it is not so easy as first thought:
I guess where my above described solution fails is when the selection is only a subset the trace data and only partially covers it. In that case the original legend entry would still need to be visible.
However, in theory it is possible to detect at creation time of the plot if the crosstalk key selection is equal to the legend entries. Eg. if the crosstalk key and the aesthetic property for the legend are equal.
That said this detection would then fail if one constructs a plotly object by manually adding traces. Or if the plotly graph has other traces added from a different dataset.
So to achieve what we want, we somehow need to determine if selection data fully covers the trace data. Not sure how we could smartly do it without having and extreme impact on the performance.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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.
Más de plotly/plotly.R
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
-
Data gets dropped in add_trace and consequently points have the wrong color if NA is present Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
-
save_image Error Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
Todos los issues de plotly/plotly.R
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
r-lib/pkgdepends#485 · 3 comentarios ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
beginners blocker
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
enviPathR AbiertoBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Bioconductor/BiocContributions#207 · 6 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
datacarpentry/semester-biology#1255 ·