Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta Para iniciantes
#8,100 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript

Direção de pesquisa

Comece reproduzindo o exemplo de unified-hoverlabel fornecido e, em seguida, inspecione src/components/legend/draw.js por volta da linha 587, onde o issue relata que o alinhamento está fixado em 'start'. Considera-se concluído quando hoverlabel.align é respeitado para os hover labels unificados de x e y, preservando o comportamento existente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug
Instructions (remove this section before submitting report)

Thanks for your interest in plotly.js!

  • Before submitting a new bug report, please search for existing and closed issues. If your bug is not addressed yet, fill out the sections below and submit a new issue.
  • Issues found on the example pages from https://plotly.com/javascript/ should be filed in our documentation repo with the exception of https://plotly.com/javascript/reference which should be filed here.
  • Implementation questions ("How do I do ...?") should be asked on our Community Forum or on Stack Overflow (tagged 'plotly').
  • Comments should add content to the discussions. Approbation comments such as +1 or I would like this feature to be implemented as well will be deleted by the maintainers. Please use GitHub reactions instead.
Description

Add a clear description of the issue that you're having.

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

Add screenshots or a video of the issue.

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

Add info here that doesn't fit in the other sections.

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).

Linguagem predominante
JavaScript
Estrelas
18.4k
Forks
2k
Merge médio
1d 21h
PRs com merge (30d)
18

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de plotly/plotly.js

Todas as issues de plotly/plotly.js

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.