Hover template for chart with "base"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided go.Waterfall example using base, y_values, and the hovertemplate containing initial, final, and delta. Reproduce the hover behavior with values below the base, then verify that hovering each bar displays the expected template values and works consistently across the chart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100