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

altair chart is size 0 when shown hidden then shown again #172

Open
cpsievert opened this issue Dec 18, 2024 · 0 comments
Open

altair chart is size 0 when shown hidden then shown again #172

cpsievert opened this issue Dec 18, 2024 · 0 comments

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Dec 18, 2024

Click tab B, then tab A. The plot size is 0.

import altair as alt
import pandas as pd
from shiny import reactive
from shiny.express import ui

from shinywidgets import render_altair

@reactive.calc
def plt():
    main_df = pd.DataFrame({
        "x": [1, 2, 3, 4, 5, 6],
        "y": [3, 4, 5, 6, 7, 8],
    })

    return (
        alt.Chart(main_df)
        .mark_circle()
        .encode(x="x", y="y")
    )


with ui.card():
    with ui.navset_pill(id="tab"):
        with ui.nav_panel("A"):

            @render_altair
            def x_y_graph():
                return plt()

        with ui.nav_panel("B"):

            @render_altair
            def y_x_graph():
                return plt()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant