Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[BUG]: percentTotal not shown as percentage

未關閉 適合新手
#8,137 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

@ORITOMI 已經在處理了。

開始於 2026年10月21日。

  • #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 內容生成。

描述

bug
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 :

Image

After :

Image
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

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

plotly/plotly.js 的其他 Issue

查看 plotly/plotly.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。