plotly / plotly/plotly.py

Hover template for chart with "base"

Abierto
#5,075 2 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P2
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

Hello!

I am creating a figure which is a Waterfall chart.

In this Waterfall chart, I am using the ‘base’ parameter.

This works perfectly for me, but I noticed a problem with the hovertemplate…
As soon as I have data below my ‘base’, the hover doesn’t work well… It doesn’t work when I am on the bar, I will let you see this in the video.

Here is the code:

import plotly.graph_objects as go

x_values = ['Waiting on union or regulatory problem', 'Up log wireline to depth inside drillstring',
                'Drill to depth', 'Slickline run other activities', 'Service Well Control Equipment',
                'Trip in to depth', 'Trip out to depth', 'Run in casing to depth', 'Drilling run other activities',
                'Rig up to run slickline', 'Run in slickline to depth', 'Make up BHA', 'Circulate to condition hole',
                'Waiting on cement to develop strength', 'Circulate to condition drilling fluid',
                'Smallest differences combined']
y_values = [-4.83333333, 1.14583333, 1.125, 1.08333333, 0.75, 0.5625, 0.5, -0.45833333, 0.41666667, 0.375, 0.35416667, -0.33333333, 0.33333333, -0.33333333, 0.29166667, 0.875]

fig = go.Figure(
        go.Waterfall(
            orientation="v",
            base=17.5625,
            x=x_values,
            y=y_values,
            customdata=y_values,
            hovertemplate=(
                    "%{x}<br>" + "Initial: %{initial:.2f}<br>" + "Final: %{final:.2f}<br>" + "Delta: %{delta:.2f}<extra></extra>"
            ),
        ),
        layout={"height": 800}    

    )
fig.show()

Link bug in forum with the video : https://community.plotly.com/t/hover-template-for-chart-with-base/90887/3

Thanks!

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 con el ejemplo proporcionado de go.Waterfall que usa base, y_values y el hovertemplate que contiene initial, final y delta. Reproduce el comportamiento del hover con valores por debajo de base y, después, verifica que al pasar el cursor sobre cada barra se muestren los valores esperados de la plantilla y que funcione de forma coherente en todo el gráfico.

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

Evaluación

Stack tecnológico
python
Á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
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.