[BUG]: `hoverlabel.align` is ignored in `hovermode: "x unified"`
维护者通常 1 天内回复
评估
- 难度
- 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 内容生成。
描述
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
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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/plotly.js 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
chore P3 plotly-internal size: 3 task
难度 2/5 1-3 小时 新手友好度 77/100
plotly/plotly.js#8064 · 1 条评论 ·
维护者通常 1 天内回复
-
chore P1 plotly-internal size: 1 task
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
chore P3 plotly-internal size: 1 task
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
plotly/plotly.js#7648 · 3 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Effect-TS/effect#8728 · 1 条评论 ·
维护者通常 1 天内回复
-
[quality] coverage gate exits 0 when the test run is killed by a signal (tests/tools/coverage-report.mjs:680 `?? 1` is untested)可能已有人在做 @hivecommons-hive 今天认领。 未关闭agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
deep-research
难度 1/5 1 小时以内 新手友好度 65/100
githubnext/gh-aw-wizard#314 ·
维护者通常 1 天内回复
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 84/100
githubnext/gh-aw-workshop#4174 ·
维护者通常 1 天内回复
-
sendDefaultPii is reported as deprecated on ReactNativeOptions although dataCollection is hidden未关闭Bug React-Native Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 85/100
getsentry/sentry-react-native#6830 · 1 条评论 ·
维护者通常 1 天内回复