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 — Add legend.itemheight to set the height of the legend fill swatch by MannXo · Pull Request #7925 · plotly/plotly.js Conversation
|
| Before | After |
|---|---|
![]() |
![]() |
npm run test-jasmine -- legend --nowatch gives 132 passing, of which 8 are new. hover_label is 221 passing. npm run lint, npm run test-syntax and npm run test-mock are all clean. test/plot-schema.json regenerated with npm run schema; dist/ deliberately untouched.
New tests:
| Test | Purpose |
|---|---|
reproduces the historical 6px swatch at the default |
pins M5,0h30v6h-30z so the default cannot drift |
grows the fill swatch to the requested height |
the feature |
grows the swatch downwards, leaving the line on top of the fill |
pins the growth direction |
does not move the swatch of a trace without fill |
guards unfilled traces |
grows each legend row so taller swatches do not overlap |
the draw.js half |
leaves row heights untouched at the default |
no regression for existing charts |
applies to unified hover labels without error |
the mockLegend path |
defaults itemheight to 6 and clamps values below the minimum |
coercion |
I verified the tests actually bind to the change rather than passing regardless. Reverting only the style.js line fails exactly the two swatch-growth tests and nothing else; reverting only the draw.js line fails exactly the row-growth test. The default-behaviour guards pass either way by design, which is what stops the feature from degenerating into "move the swatch".
itemheight currently drives only the fill swatch. Bar and marker swatches have their own fixed geometry (styleBars draws M6,6H-6V-6H6Z, a 12x12 square). Should itemheight drive those too, or stay fill-only as the issue requests?min: 6. Chosen to match today's height and to mirror itemwidth's min === dflt. Happy to lower it if you would rather allow thinner swatches.legend.valign already offers some control here and the default is untouched, so I left text positioning alone rather than adding a second alignment mechanism. Say the word if you would prefer the label centred on the swatch.No image mock is included yet. The itemwidth precedent is test/image/mocks/legend_itemwidth_dashline.json, so I am happy to add one, but since baselines are generated on ubuntu-latest I would rather take the baseline from CI than commit a macOS render. Let me know and I will add it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for the PR! Our team will review and follow up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing this, since it has fallen behind main without being picked up for review. Happy to rebase and reopen if it's still wanted. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Let's keep it open. You happened to open your PR when we trying to get v4 out the door, so it fell our radar. It's back on now! Could you please merge main and address any conflicts that come up? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Regenerate src/types/generated/schema.d.ts for legend.itemheight.
|
Thanks for reopening. I merged main and resolved the one conflict (both sides appended tests at the end of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I made some changes to address the swatch overflow. Now the swatch can grow along with the row and the label will remain centered. I refactored the calcs to save some of the "magic numbers" into constants with descriptions. That should help future devs understand how they're being used and why. Could you please add or update a mock to show this feature? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The mock draws five fillpattern traces with a legend. A 20px fill swatch makes each pattern visible in the legend, so the image test covers the new attribute.
|
You can grab the new baseline from the failed CI run. Commit the new one and the baseline tests should pass. Then we can get this approved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Taken from the baselines-default-diff artifact of the failed test-baselines run.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature!
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.
[FEATURE]: Settingitemheight (analogous to itemwidth) to increase height of fill in legend
There was an error while loading. Please reload this page.