GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||
GeezerVison is showing github.com — fix: Apply `hoverlabel.align` to unified hover label items by MannXo · Pull Request #8104 · plotly/plotly.js Conversation
|
| Before | After |
|---|---|
![]() |
![]() |
npm run test-jasmine -- hover legend --nowatch passes (357 specs). The new spec fails on main.const gd = Tabs.fresh(); Plotly.newPlot( gd, [ { type: 'bar', x: ['A', 'B', 'C'], y: [3944, 2810, 1675], name: 'Series 1' }, { type: 'bar', x: ['A', 'B', 'C'], y: [-266, -1020, -85], name: 'Series 2' }, { type: 'bar', x: ['A', 'B', 'C'], y: [-44, -310, -7], name: 'Series 3' } ], { barmode: 'relative', hovermode: 'x unified', hoverlabel: { align: 'right' } } );
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Unified hover labels draw their items through the legend, which always anchors item text at the start. The resolved hoverlabel.align of each point was never read there, so layout and trace values had no effect. Items with align 'right' now anchor at the right edge of the label. Closes plotly#8100
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This looks like a reasonable solution. Could you please address the failing test in CI? Also, could you update the hoverlabel.align description in fx/layout_attributes.js to fix the typo?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| _hover(gd, { xval: 1 }); | ||
| const [short, long] = getItems(); | ||
| expect([short.anchor, long.anchor]).toEqual(['end', 'start']); | ||
| expect(short.right).toBeCloseTo(long.right, 0); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This check is failing in CI. It's likely due to font rendering differences between your computer and CI. You could change the check to the following to make it a bit more forgiving:
| expect(short.right).toBeCloseTo(long.right, 0); | |
| expect(short.right).toBeWithin(long.right, 1); |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The description read "spans more two or more lines". The right-edge check compared positions to the nearest pixel, and font rendering differs between machines, so it failed in CI.
This reverts commit 3915055.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[BUG]:hoverlabel.align is ignored in hovermode: "x unified"
There was an error while loading. Please reload this page.