-
Notifications
You must be signed in to change notification settings - Fork 121
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
fix(partition): rtl text label support #1433
Conversation
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.
It looks good, but I can't understand the language used here and I can't say if that is correct or not.
@ghudgins do you know someone that knows an RTL language to confirm our tests are valid?
The only think I see is that the RTL text in the pie starts at the bottom, I'm not sure but RTL text is not automatically a bottom to top language.
@markov00 what are your thought about adding a way to set the UPDATEPer zoom chat, we assign global canvas |
- Add better alignment support for partition fill and link labels - Better support for mixed text with force ctx.direction - Improve legend and tooltip styles for rtl strings and mixed
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.
I still need to update the unit and VRT's with latest changes.
packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/layout/viewmodel/link_text_layout.ts
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
packages/charts/src/chart_types/xy_chart/renderer/canvas/utils/has_mostly_rtl.ts
Show resolved
Hide resolved
packages/charts/src/chart_types/partition_chart/layout/types/viewmodel_types.ts
Outdated
Show resolved
Hide resolved
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.
Changes looks good to me, tested locally and works great!
packages/charts/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
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.
LGTM, great addition! Thanks for adopting the small code suggestions and the addition of more RTL languages 👍
## [39.0.1](v39.0.0...v39.0.1) (2021-11-15) ### Bug Fixes * **partition:** rtl text label support ([#1433](#1433)) ([01bbe3a](01bbe3a))
support rtl text labels in xy and partition charts, including mixed ltr/rtl. # Conflicts: # packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts # packages/charts/src/chart_types/xy_chart/renderer/canvas/axes/tick_label.ts # packages/charts/src/chart_types/xy_chart/state/selectors/visible_ticks.ts # packages/charts/src/chart_types/xy_chart/utils/axis_utils.test.ts # packages/charts/src/chart_types/xy_chart/utils/axis_utils.ts
Summary
Better support RTL text value in
partition
andxy
charts. Current support is automatically applied given the label text characters.Screen.Recording.2021-10-21.at.04.10.52.PM.mp4
Details
Partition charts parse the words individually by performing
.split(' ')
on the string to obtain the words. Thus the global canvasdir
attribute alone will not fix the issue.treemap && RTL->'right'
,treemap && not RTL->'left'
,sunburst->'center'
. We could expose this to the user later.Styles for DOM elements, not canvas, are mostly handled by default by just setting the
dir
ordirection
on an element, with a few exceptions. These exceptions are handled with css overrides for[dir=rtl]
.The only visual change in this PR is that the formatted value string in fill labels used to be split to allow for better fitting. This caused issues related to RTL strings so I removed this and now the value strings act as a single string.
This PR adds pretty good support for
rtl
text inpartition
andxy
charts and applies the globaldir
setting on thecanvas
element for both based on .Missing support
rtl
strings formatted values will show in reverse.ltr
.Issues
fix #1432
Checklist
:xy
,:partition
)closes #123
,fixes #123
)