Skip to content

Hover event not triggered on consecutive empty bins (count=0) with hovermode:'x' for histogram #7502

@Lexachoc

Description

@Lexachoc

Reproducible example

See the demo: https://codepen.io/Lexachoc/pen/MYaJGgo

The problem

When using hovermode:'x', the hoverinfo is displaying when hovering through all bins (including those count=0).

Note that the binNumber (extracted from the hover event) has remained at the first empty bin number!

Recording:
Image

Why this is important to address

  1. It breaks the expected behavior of hovermode:'x' over consecutive zero-count bins.
    I expected hover events to fire across the entire x-axis regardless of the bin value (y value).
  2. plotly_hover reports stale binNumber value, unable to know the actual bin under the cursor when y=0 (count=0).

Note

I use hovermode:'x' because I want hover events to trigger even when the cursor is above the bin, not just directly over the bar area. The default hover behavior only fires when hovering on the bar itself.

Use case

You can see the hover highlight becomes disconnected because no hover event is fired over consecutive zero-count bins, causing the effect to break.

PixPin_2025-07-31_16-39-30.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclebugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions