-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[charts] Fix RTL legend #12175
[charts] Fix RTL legend #12175
Conversation
Deploy preview: https://deploy-preview-12175--material-ui-x.netlify.app/ |
Yes. You should invert the order of the square/text.
…On Thu, Feb 22, 2024, 4:40 PM Alexandre Fauquette ***@***.***> wrote:
Fix #12118 <#12118>
image.png (view on web)
<https://github.com/mui/mui-x/assets/45398769/de6e0caa-bb66-488b-8b7c-e34efcdaf633>
Maybe I should invert the order of square/text : put the square on the
right of the text @samueltrevor <https://github.com/samueltrevor> do you
have some insight on this aspect?
------------------------------
You can view, comment on, or merge this pull request online at:
#12175
Commit Summary
- 6ff6252
<6ff6252>
[charts] Fix RTL legend
File Changes
(1 file <https://github.com/mui/mui-x/pull/12175/files>)
- *M* packages/x-charts/src/ChartsLegend/DefaultChartsLegend.tsx
<https://github.com/mui/mui-x/pull/12175/files#diff-9e0ea522b9a333b5a5622a47238c31a8eb5843e6ac023b4df87e34ad1bd14085>
(17)
Patch Links:
- https://github.com/mui/mui-x/pull/12175.patch
- https://github.com/mui/mui-x/pull/12175.diff
—
Reply to this email directly, view it on GitHub
<#12175>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AX3J63ULVFZWLRW5R5R7IPDYU5KF5AVCNFSM6AAAAABDVCF2YCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DSMRSGIYDINY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
return [ | ||
seriesWithRawPosition.map((item) => ({ | ||
...item, | ||
positionY: | ||
item.positionY + | ||
(direction === 'row' | ||
? rowMaxHeight[item.rowIndex] / 2 // Get the center of the entire row | ||
: item.outerHeight / 2), // Get the center of the item | ||
})), | ||
totalWidthUsed, | ||
totalHeightUsed, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before it was absolute position. Non I return the size of the legend, and position are relative to the inside of this box.
The gapX
, gapY
that are made to align the legend with the border of the chart are moved outside such that we can simply invert
positionX
to legendWidth - positionX
to revert line order without having to care about where the legend is in the the chart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement! 💙
Fix #12118
Maybe I should invert the order of square/text : put the square on the right of the text @samueltrevor do you have some insight on this aspect?