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

echarts whit tabs #54

Open
josepaulo1233 opened this issue Jul 25, 2023 · 2 comments
Open

echarts whit tabs #54

josepaulo1233 opened this issue Jul 25, 2023 · 2 comments

Comments

@josepaulo1233
Copy link

Hey,

I’m trying to make a line and bar chart using st_echarts and separating them with a st.tabs

However, when the second tab is selected, the chart is not displayed…

tabs_echarts_2

from streamlit_echarts import st_echarts
import streamlit as st

tab1, tab2 = st.tabs(['Line', 'Bar'])

with tab1:
    options = {
    "xAxis": {
        "type": "category",
        "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
    },
    "yAxis": {"type": "value"},
    "series": [
        {"data": [820, 932, 901, 934, 1290, 1330, 1320], "type": "line"}
    ],
    }
    st_echarts(options=options)

with tab2:
    options = {
        "xAxis": {
            "type": "category",
            "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        "yAxis": {"type": "value"},
        "series": [
            {"data": [820, 932, 901, 934, 1290, 1330, 1320], "type": "bar"}
        ],
    }
    st_echarts(options=options)
@doliveira-lts
Copy link

doliveira-lts commented Aug 29, 2023

Hi! Try adding this to your code:

st.write(
            '<style>iframe[title="streamlit_echarts.st_echarts"]{ height: 500px !important }</style>',
            unsafe_allow_html=True
 )

@nicedouble
Copy link

@doliveira-lts ,i has the same issue.But i use sac.tabs my custom component streamlit-antd-components instand of st.tabs.

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

3 participants