Skip to content

[AdvancedLayouts] Modernize width and height for st.area_chart and st.bar_chart#12672

Merged
sfc-gh-lwilby merged 1 commit intodevelopfrom
feature/area-bar-chart-height
Oct 1, 2025
Merged

[AdvancedLayouts] Modernize width and height for st.area_chart and st.bar_chart#12672
sfc-gh-lwilby merged 1 commit intodevelopfrom
feature/area-bar-chart-height

Conversation

@sfc-gh-lwilby
Copy link
Copy Markdown
Collaborator

Describe your changes

Modernizes st.area_chart and st.bar_chart to use the new Height and Width type systems ("stretch", "content", or pixel values) for consistency with other chart elements.

Also begins deprecation of use_container_width, which will be removed after 12-31-2025. When explicitly set, use_container_width=True maps to width="stretch" and use_container_width=False maps to width="content".

Changes Made:

  • Updated parameter signatures:
    • width: int | None = NoneWidth = "stretch"
    • height: int | None = NoneHeight = "content"
    • use_container_width: bool = Truebool | None = None (deprecated)
  • Preserved backward compatibility: Existing integer values and use_container_width behavior still work with deprecation warnings
  • Updated layout system: Uses LayoutConfig(width=width, height=height) for consistent layout handling
  • Enhanced validation: Added proper parameter validation with clear error messages

GitHub Issue Link (if applicable)

N/A

Testing Plan

  • Unit Tests (Python) - Width/height parameter functionality and backward compatibility
  • Unit Tests (Python) - use_container_width deprecation warnings
  • E2E Tests - Visual behavior across width/height values ("content", "stretch", pixel values)
  • Manual testing completed

Additional Notes:

Part of the broader AdvancedLayouts initiative to provide consistent width and height APIs across all chart elements.


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Sep 30, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 30, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12672/streamlit-1.50.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12672.streamlit.app (☁️ Deploy here if not accessible)

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Sep 30, 2025

🎉 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)

@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review September 30, 2025 17:37
@sfc-gh-lwilby sfc-gh-lwilby changed the title [WIP][AdvancedLayouts] Modernize width and height for st.area_chart and st.bar_chart [AdvancedLayouts] Modernize width and height for st.area_chart and st.bar_chart Sep 30, 2025
@sfc-gh-lwilby sfc-gh-lwilby merged commit bfbd964 into develop Oct 1, 2025
45 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the feature/area-bar-chart-height branch October 1, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants