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

[BUG]: `hoverlabel.align` is ignored in `hovermode: "x unified"`

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

維護者通常 1 天內回覆

@MannXo 已經在處理了。

開始於 2026年10月3日。

  • #8104 來自 @MannXo —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript

研究方向

先重現所提供的 unified-hoverlabel 範例,接著檢查 src/components/legend/draw.js 第 587 行附近的位置,issue 回報這裡將對齊方式硬編碼為 'start'。完成標準是:對於統一的 x 和 y hover label,遵循 hoverlabel.align,同時維持現有行為不變。

由索引模型根據 Issue 內容生成。

描述

bug good first issue P2 size: 1
Description

layout.hoverlabel.align (and trace-level hoverlabel.align) has no effect when hovermode is 'x unified' or 'y unified'. Row text in the unified label is always left-aligned.

Reported on the forum: https://community.plotly.com/t/hoverlabel-align-right-is-not-honored-in-hovermode-x-unified/97717

Repro

import plotly.graph_objects as go

people = ["Person A", "Person B", "Person C"]

fig = go.Figure()
for name, values in {
    "Series 1": [3944, 2810, 1675],
    "Series 2": [-266, -1020, -85],
    "Series 3": [-44, -310, -7],
    "Series 4": [-43, -5, -390],
}.items():
    fig.add_trace(go.Bar(x=people, y=values, name=name, hovertemplate="%{y:,.0f} €<extra></extra>"))

# --- secondary-axis line: delete this block to test without it ---
fig.add_trace(go.Scatter(
    x=people, y=[0.91, 0.62, 0.785], name="Ratio",
    mode="lines+markers", yaxis="y2", line=dict(color="black"),
    hovertemplate="%{y:.1%}<extra></extra>",
))
fig.update_layout(yaxis2=dict(overlaying="y", side="right", tickformat=".0%"))
# --- end ---

fig.update_layout(
    barmode="relative",
    separators=". ",
    hovermode="x unified",
    hoverlabel=dict(align="right"),
    # Same with
    # hoverlabel_align="right",
)
fig.show()

Expected: values right-aligned within the unified label.
Actual: left-aligned.

Screenshots/Video
Image
Steps to reproduce

Reports must include steps to reproduce the issue. Alternatively, you can use codepen, jsfiddle or jsbin to share your example. Please use the latest (un-minified) version of plotly.js in your report unless not applicable.

  • Go to '...'
  • Click on X
  • Note the issue with Y
Notes

This does appear to be a bug in plotly.js. The label is hardcoded to use 'start'.


It seems to lead to a 9 year old code (standardize on attr over style for text-anchor · plotly/plotly.js@3ad11f6 · GitHub).

主要語言
JavaScript
星號
18.4k
分支
2k
平均合併
2 天 7 小時
30 天內合併 PR
18

環境準備

從這裡開始

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

plotly/plotly.js 的其他 Issue

查看 plotly/plotly.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

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

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