Skip to content

Commit

Permalink
fix: viewer container size base on the root iframe in streamlit
Browse files Browse the repository at this point in the history
  • Loading branch information
longxiaofei committed Apr 28, 2024
1 parent 68f770e commit 479328d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,13 @@ function ChartPreviewApp(props: IChartPreviewProps, id: string) {

function GraphicRendererApp(props: IAppProps) {
const computationCallback = getComputationCallback(props);
const containerSize = props["containerSize"] ?? [null, null];
const globalProps = {
rawFields: props.rawFields,
containerStyle: { height: "700px", width: "60%" },
containerStyle: {
height: containerSize[1] ? `${containerSize[1]-200}px` : "700px",
width: containerSize[0] ? `${containerSize[0]-20}px` : "60%"
},
themeKey:props.themeKey,
dark: useContext(darkModeContext),
}
Expand Down
2 changes: 1 addition & 1 deletion pygwalker/api/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def viewer(
scrolling: bool = False,
) -> "DeltaGenerator":
"""Render filter renderer UI"""
html = self._get_html(mode="filter_renderer")
html = self._get_html(mode="filter_renderer", **{"containerSize": [width, height]})
return components.html(html, height=height, width=width, scrolling=scrolling)

@deprecated("render_filter_renderer is deprecated, use viewer instead.")
Expand Down

0 comments on commit 479328d

Please sign in to comment.