[AdvancedLayouts] Add height to st.altair_chart#12630
Merged
sfc-gh-lwilby merged 3 commits intodevelopfrom Sep 25, 2025
Merged
Conversation
- Adds height parameter using Height type system for consistency - Includes E2E tests for visual height behavior validation - Updates backend implementation with native chart height support - Adds comprehensive unit tests for height parameter functionality
Contributor
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
Contributor
✅ PR preview is ready!
|
sfc-gh-bnisco
approved these changes
Sep 25, 2025
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
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
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.
Describe your changes
Adds a new
heightparameter tost.altair_chartusing theHeighttype system ("stretch","content", or pixel values) for consistency with other chart elements.Changes Made:
height: Height = "content"parameter tost.altair_chartheight="content"(default): Respects Altair chart's native height if specified in chart propertiesheight="stretch": Expands to fill the parent container's heightheight=<integer>: Sets fixed pixel heightKey Implementation Details:
Height Parameter Addition:
heightparameter with defaultheight="content"height="content"extracts height from native Altair chart object if availableheight="stretch"properly fills parent containers (tested in 500px container)GitHub Issue Link (if applicable)
Part of the AdvancedLayouts initiative
Testing Plan
height="content")height=250)height="content"with chart spec height=180)height="stretch"in 500px container)Screenshots/Demos:
(E2E test snapshots show visual differences for all height behaviors: fixed pixels, content-based, and container stretching)
Additional Notes:
This extends the AdvancedLayouts initiative by adding height support to
st.altair_chart, bringing it in line with other chart elements that support theHeighttype system. The default ofheight="content"ensures backward compatibility while enabling users to override with"stretch"for responsive designs or specific pixel values for fixed layouts.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.