Skip to content

Fix unified hover swatch for bar shape.pattern arrays (#8008) - #1

Draft
Dmao233 wants to merge 3 commits into
mainfrom
cursor/fix-8008-bar-pattern-unified-hover-f220
Draft

Dmao233 wants to merge 3 commits into
mainfrom
cursor/fix-8008-bar-pattern-unified-hover-f220

Conversation

@Dmao233

@Dmao233 Dmao233 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Unified hover always drew the bar pattern swatch from index 0. The hovered point now supplies the pattern index, so the swatch matches that bar.

Fixes plotly#8008

The mock legend in hovermode: 'x unified' reused legend/style.js styleBarLike. That path read marker.pattern at index 0 for every point. Color also stayed on the first bar because coercePattern copies marker.color into pattern.fgcolor as an array.

This change:

  • Reads pattern attrs at the hovered index when the legend is a unified hover mock
  • Gives hover pattern defs their own id so they do not overwrite the real legend

This pull request does not touch dist/.

Draftlog: draftlogs/1_fix.md

Tests: hover_test.js (hovermode: (x|y)unified).
I ran npm run test-jasmine -- hover --nowatch --report-spec.
The new spec should style bar pattern swatches from the hovered point passed.
Related specs for bar, funnel, and waterfall swatches also passed.
Eight other specs in that file failed. Those failures look unrelated to pattern swatches.

I did not inspect the rendered hover tooltip by eye. Please hover the issue figure and confirm the swatch.

🐦

Open in Web Open in Cursor 

Dmao233 and others added 2 commits September 14, 2026 01:29
Unified hover built the bar swatch from pattern index 0.
Use the hovered point index so color and pattern match that bar.

Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
The fork pull request number is now known.

Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/fix-8008-bar-pattern-unified-hover-f220 branch from 0f631c4 to f341c93 Compare September 14, 2026 01:32
Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: shape.pattern for bar trace causes color and pattern to be applied to wrong traces in unified hover tooltip

1 participant