[BUG]: percentTotal not shown as percentage
維護者通常 2 天內回覆
評估
- 難度
- 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
- 分支
- 2k
- 平均合併
- 3 天 2 小時
- 30 天內合併 PR
- 15
環境準備
- 沒有 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
-
routine:ci-review
難度 2/5 1-3 小時 新手友好度 66/100
harlan-zw/unlighthouse#456 · 1 則留言 ·
維護者通常 1 天內回覆
-
beginner enhancement good first issue
難度 2/5 1-3 小時 新手友好度 82/100
philaconvalley/website#217 ·
維護者通常 1 天內回覆
-
bug confirmed issue
難度 2/5 1-3 小時 新手友好度 70/100
open-webui/open-webui#32896 · 2 則留言 ·
維護者通常 1 天內回覆
-
⚠ needs intervention document not found
難度 2/5 1-3 小時 新手友好度 68/100
OpenTermsArchive/contrib-declarations#4151 ·
維護者通常 1 天內回覆
-
correction via-web
難度 2/5 1-3 小時 新手友好度 67/100
ch-bas/cctv-camera-database#416 ·
維護者通常 1 天內回覆