generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: set the legend horizontal alignment #118
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pan-kot
reviewed
Oct 29, 2025
pan-kot
reviewed
Oct 29, 2025
2729809 to
7a3e853
Compare
Contributor
Author
|
Got tangled with my branches. Sorry about the latest push (that I reverted) I see the build is failing (due to credentials not being fetched). Should I do something about it? |
Member
|
Due to the current wrapping behaviour, centering the legend can feel broken when it is sufficiently large. Do we expect this to be only relevant for small legends? Screen.Recording.2025-11-12.at.10.46.46.mov |
pan-kot
reviewed
Nov 12, 2025
pan-kot
reviewed
Nov 12, 2025
pan-kot
reviewed
Nov 12, 2025
src/internal/components/chart-legend/__tests__/chart-legend-horizontal-alignment.test.tsx
Outdated
Show resolved
Hide resolved
Contributor
Author
pan-kot
approved these changes
Nov 13, 2025
Merged
via the queue into
cloudscape-design:main
with commit Nov 13, 2025
5a52162
42 of 44 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Description
This PR adds support for horizontal alignment of chart legends when positioned at the bottom. The new horizontalAlignment property allows legends to be aligned to the start or center of the chart container.
Key changes:
• Added horizontalAlignment property to CoreChartProps.LegendOptions (supports "start" and "center")
• Updated legend component to apply alignment styles for bottom-positioned legends
• Added demo pages for dual-axis charts and pie charts
How has this been tested?
• Manually tested the new horizontalAlignment property with bottom-positioned legends in the demo pages (core-line-chart, dual-axis-chart, and pie chart demos)
• Verified that alignment only applies when legend position is "bottom"
• Tested that the alignment control is properly disabled when legend is hidden or positioned on the side
• Verified backward compatibility by ensuring the property is optional
To test:
2025-10-28_13-53-20.mp4
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
• [x] Changes include appropriate documentation updates.
• [x] Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
• [x] Changes do not include unsupported browser features, see CONTRIBUTING.md.
• [x] Changes were manually tested for accessibility, see accessibility guidelines.
Security
• [x] If the code handles URLs: all URLs are validated through the checkSafeUrl function. (N/A - no URL handling)
Testing
• [x] Changes are covered with new/existing unit tests?
• [x] Changes are covered with new/existing integration tests?