Legend: fix layout padding handling #9290
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#Fix #9278
There would still be a lot to clean up, but I don't have the time currently.
The positioning of items is duplicated, first one that calculates the rows/columns is done in
fit
, where the dimensions are what were set insetDimensions
. core.layouts updates the coordinates there:Chart.js/src/core/core.layouts.js
Lines 192 to 206 in fb863f3
Notice the
userPadding.right
used forbox.bottom
So the
top
that was set to0
is updated to the padding value, and the height updated accordingly. This makes the items split in columns earlier thanfit
would have thought.The fix
margins.top
andmargins.left
insetDimensions
Chore
top
variable and useitemHeight
instead offontSize
for calculating the column height.