diff --git a/examples/streamlit_demo.py b/examples/streamlit_demo.py index 1c986a5b..e569e118 100644 --- a/examples/streamlit_demo.py +++ b/examples/streamlit_demo.py @@ -23,8 +23,8 @@ def get_pyg_renderer() -> "StreamlitRenderer": st.subheader("Display Explore UI") -tab1, tab2, tab3, tab4 = st.tabs( - ["graphic walker", "data profiling", "graphic renderer", "pure chart"] +tab1, tab2, tab3, tab4, tab5 = st.tabs( + ["graphic walker", "data profiling", "graphic renderer", "pure chart", "table"] ) with tab1: @@ -41,3 +41,6 @@ def get_pyg_renderer() -> "StreamlitRenderer": renderer.chart(0) st.markdown("### registered per day") renderer.chart(1) + +with tab5: + renderer.table() diff --git a/pygwalker/__init__.py b/pygwalker/__init__.py index 860ebc04..11637983 100644 --- a/pygwalker/__init__.py +++ b/pygwalker/__init__.py @@ -10,7 +10,7 @@ from pygwalker.services.global_var import GlobalVarManager from pygwalker.services.kaggle import show_tips_user_kaggle as __show_tips_user_kaggle -__version__ = "0.4.9.5" +__version__ = "0.4.9.6" __hash__ = __rand_str() from pygwalker.api.jupyter import walk, render, table diff --git a/pygwalker/api/jupyter.py b/pygwalker/api/jupyter.py index 01b41adf..9c21a189 100644 --- a/pygwalker/api/jupyter.py +++ b/pygwalker/api/jupyter.py @@ -183,4 +183,4 @@ def table( **kwargs ) - walker.display_on_jupyter_use_widgets("800px") + walker.display_on_jupyter_use_widgets(iframe_height="800px") diff --git a/pygwalker/api/streamlit.py b/pygwalker/api/streamlit.py index e90da54c..967b86b1 100644 --- a/pygwalker/api/streamlit.py +++ b/pygwalker/api/streamlit.py @@ -251,11 +251,20 @@ def chart( def render_pure_chart(self, *args, **kwargs): return self.chart(*args, **kwargs) + def table( + self, + *, + key: str = "table", + ): + """Render pure table UI""" + key = f"{self.walker.gid}-{key}" + return self._component(key=key, mode="table") + def _component( self, *, key: str, - mode: Literal["explore", "renderer", "filter_renderer"], + mode: Literal["explore", "renderer", "filter_renderer", "table"], vis_spec: Optional[List[Dict[str, Any]]] = None, **kwargs: Dict[str, Any] ): @@ -283,7 +292,7 @@ def get_streamlit_html( show_cloud_tool: Optional[bool] = None, spec_io_mode: ISpecIOMode = "r", kanaries_api_key: str = "", - mode: Literal["explore", "filter_renderer"] = "explore", + mode: Literal["explore", "filter_renderer", "table"] = "explore", default_tab: Literal["data", "vis"] = "vis", **kwargs ) -> str: