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 摘要。