[BUG]: percentTotal not shown as percentage
维护者通常 2 天内回复
已经有一个关联 PR 被合并了。
- #8139 来自 @ORITOMI —— 已合并
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 93/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
阅读 src/traces/bar/plot.js,其中 issue 指出了属性名中的拼写错误,并检查 test/jasmine/tests/funnel_test.js 中 funnel 的覆盖情况。运行 funnel 测试,并确认对于报告的值,%{percentTotal} 显示为 50%、33% 和 17%。
由索引模型根据 Issue 内容生成。
描述
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 !
- 主要语言
- JavaScript
- 星标
- 18.4k
- 派生
- 2.1k
- 平均合并
- 4 天 15 小时
- 30 天内合并 PR
- 16
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/plotly.js 的其他 Issue
-
bug P3 size: 3
难度 2/5 1-3 小时 新手友好度 86/100
plotly/plotly.js#8108 · 4 条评论 ·
维护者通常 2 天内回复
-
chore P3 plotly-internal size: 3 task
难度 2/5 1-3 小时 新手友好度 77/100
plotly/plotly.js#8064 · 1 条评论 ·
维护者通常 2 天内回复
-
chore P1 plotly-internal size: 1 task
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 2 天内回复
-
chore P3 plotly-internal size: 1 task
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 2 天内回复
-
[mkdocs] Update link in Edit this Page button可能重新可做 @AbhinavKumar-Jha 于 154 天前认领,目前没有进行中的 PR。 未关闭bug
难度 2/5 1-3 小时 新手友好度 65/100
plotly/plotly.js#7648 · 3 条评论 ·
维护者通常 2 天内回复
相似的 Issue
-
needs-triage Technical TODO
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
AOSSIE-Org/BabyNest#268 ·
维护者通常 1 天内回复
-
[UI] Long trace names cause header flexbox overflow, pushing search bar and controls off-screen可能已有人在做 @shubhtrek 今天认领。 未关闭bug
难度 1/5 1 小时以内 新手友好度 88/100
jaegertracing/jaeger-ui#4636 · 2 条评论 ·
维护者通常 2 天内回复
-
Add: DG:TV未关闭channels:add check:passed
难度 2/5 1-3 小时 新手友好度 68/100
-
[Bug Report][3.13.7] VDataTable with select-strategy="single" shows select-all checkbox in mobile mode可能已有人在做 @lazerg 今天认领。 未关闭S: triage
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复