Skip to content
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

Use Streamlit's officially recommended method to render Pygwalker UI #531

Open
longxiaofei opened this issue Apr 18, 2024 · 0 comments
Open
Labels

Comments

@longxiaofei
Copy link
Contributor

longxiaofei commented Apr 18, 2024

Use Streamlit's officially recommended method to render Pygwalker UI, so the following changes have been made:

1.Temporary delete the Exploer button under pure chart

Under the new rendering method, Pygwalker needs to complete the Request-Response communication through rerun, and retun will lose the state of modal.

old:

image

new:

image

2. Modify the parameters of the rendering method

The new API will delete width, height, scrolling parameters, and when the user needs to render the same component multiple times, different keys need to be used, which will be consistent with the parameters of the official streamlit component.

old:

def viewer(
    self,
    width: Optional[int] = None,
    height: int = 1010,
    scrolling: bool = False,
) -> "DeltaGenerator":
    """Render filter renderer UI"""
    pass

def explorer(
    self,
    width: Optional[int] = None,
    height: int = 1010,
    scrolling: bool = False,
    default_tab: Literal["data", "vis"] = "vis"
) -> "DeltaGenerator":
    """Render explore UI(it can drag and drop fields)"""
    pass

def chart(
    self,
    index: int,
    width: Optional[int] = None,
    height: Optional[int] = None,
    scrolling: bool = False,
    pre_filters: Optional[List[PreFilter]] = None,
) -> "DeltaGenerator":
    pass

new:

def viewer(
    self,
    *,
    key: str = "viewer",
    size: Optional[Tuple[int, int]] = None
):
    """Render filter renderer UI"""
    pass

def explorer(
    self,
    *,
    key: str = "explorer",
    default_tab: Literal["data", "vis"] = "vis"
):
    """Render explore UI(it can drag and drop fields)"""
    pass

def chart(
    self,
    index: int,
    *,
    key: str = "chart",
    size: Optional[Tuple[int, int]] = None,
    pre_filters: Optional[List[PreFilter]] = None,
):
    pass

beta version: pip install pygwalker==0.4.9a3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant