[BUG]: percentTotal not shown as percentage
Maintainers usually reply within 2 days
A pull request for this has already been merged.
- #8139 by @ORITOMI — merged
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 93/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- data-visualization, frontend
Research direction
Read src/traces/bar/plot.js, where the issue identifies a property-name typo, and inspect the funnel coverage in test/jasmine/tests/funnel_test.js. Run the funnel tests and confirm that %{percentTotal} renders as 50%, 33%, and 17% for the reported values.
Written by the indexing model from the issue text.
Description
Description
This issue is related to plotly.py#4368, which was addressed in Plotly.py 5.17.0. However, the issue is still reproducible with Plotly.py 7.1.0 and Plotly.js 4.1.2.
The root cause is a typo in src/traces/bar/plot.js. Plotly.js correctly computes percentTotal, but assigns the formatted percentage to percenTotalLabel instead of percentTotalLabel (missing "t").
As a result, funnel text templates using %{percentTotal} display the raw ratio rather than the formatted percentage.
Screenshots/Video
Before :
After :
Steps to reproduce
python
import plotly
import plotly.graph_objects as go
print("Plotly version:", plotly.__version__)
fig = go.Figure(
go.Funnel(
name="X",
y=["A", "B", "C"],
x=[40, 30, 20],
textposition="inside",
texttemplate=(
"%{value}<br>"
"%{percentPrevious}<br>"
"%{percentTotal}"
),
)
)
fig.show()
Solution
The issue was fixed by correcting the property name in src/traces/bar/plot.js.
A regression test was also added to test/jasmine/tests/funnel_test.js to verify that %{percentTotal} renders as 50%, 33%, and 17% for the corresponding funnel values.
Validation
The funnel test suite failed before the fix because the labels contained raw ratios.
All 63 funnel tests passed after the fix.
Linting and type checking passed.
To validate the fix locally in Plotly.py, the build issue was worked around, Plotly.js was built and packed, and the resulting local bundle was imported in Plotly.py 4.1.0.
The local test ran successfully and confirmed that the percentage labels were formatted correctly.
Notes
I'm new in contributing on open source project, any advice are welcome !
- Dominant language
- JavaScript
- Stars
- 18.4k
- Forks
- 2.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from plotly/plotly.js
-
bug P3 size: 3
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
plotly/plotly.js#8108 · 4 comments ·
Maintainers usually reply within 2 days
-
chore P3 plotly-internal size: 3 task
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
plotly/plotly.js#8064 · 1 comment ·
Maintainers usually reply within 2 days
-
chore P1 plotly-internal size: 1 task
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
chore P3 plotly-internal size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
[mkdocs] Update link in Edit this Page buttonMay be free again @AbhinavKumar-Jha claimed this 155 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
plotly/plotly.js#7648 · 3 comments ·
Maintainers usually reply within 2 days
All issues in plotly/plotly.js
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Jason-Vaughan/TangleClaw#2546 ·
Maintainers usually reply within 1 day
-
area:integration enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Documentation status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mastra-ai/mastra#28194 · 1 comment ·
Maintainers usually reply within 1 day
-
ai-authored
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Maintainers usually reply within 1 day
-
security(chat): require user confirmation before executing assistant-suggested package installationsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
francordel/myrtia#77 ·
Maintainers usually reply within 1 day