plotly / plotly/plotly.R

hovertemplate not parsed with text input

Abierto
#2,036 1 comentario 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

Hello plotly.R,

I'm using the hovertemplate in a bar chart with my data segmented using the color argument. I wish to use the text value in my hovertemplate.
The issue is that the template is not processed for one of my two segments.

Run the below code, and hover on the three bars. For the first two, the hover info is correct, for the last one, it shows the template part where the text is supposed to go.

Note 1: replacing text with y works in this case. But there could be a case where I really need the text and not the y.
Note 2: the texttemplate does not have this issue and correctly shows the value of the text in all three bars.

library(plotly)

df <- data.frame(year = c('2021', '2020', '2019'), value = c(123, 110, 95))
plot_ly(data = df, x=~year, y=~value, text=~value, type='bar', color=~(year=='2021'),
        textposition = 'outside', texttemplate = '%{text:.2s}',
        hovertemplate = paste('Year: %{x}', '<br>Value: %{text:.4s}<br><extra></extra>'))

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 ejecutando el ejemplo proporcionado de plot_ly y compara hovertemplate con texttemplate en las tres barras, especialmente el segmento de 2019. Rastrea cómo las entradas de R text, color y hovertemplate se pasan al gráfico renderizado; se considera terminado cuando %{text} muestra el valor esperado para cada barra.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
r
Área
data-visualization
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.