Hi everyone,
I started using dash plotly a month back and now I am facing some issues when switching between tabs.
I am not talking about creating the figure but the switching tabs part without changing the content.
I tried few tricks like to put it in callback but it just gets worse
Below is a simple example:
import plotly.express as px
import dash
import dash_html_components as html
import dash_core_components as dcc
number_of_fig=100
figures_list=
for i_fig in range(number_of_fig):
df = px.data.gapminder().query(“country==‘Canada’”)
fig = px.line(df, x=“year”, y=“lifeExp”, title=‘Life expectancy in Canada’)
figures_list.append(fig)
figures_table=html.Table(
[html.Tr([dcc.Graph(figure=figures_list[i_col])],style={‘border’: ‘1px solid black’}) for i_col in range(number_of_fig)
],style={‘width’:‘100%’,‘height’:‘80vh’, ‘border’: ‘1px solid black’})
tab01 = dcc.Tab(label=‘Tab01’,children=[figures_table])
tab02 = dcc.Tab(label=‘Tab02’,children=)
tab03 = dcc.Tab(label=‘Tab03’,children=)
tabs=html.Div([dcc.Tabs([tab01,tab02,tab03], id=‘tabs’, style={‘height’:50, ‘width’:‘100%’})])
app = dash.Dash()
app.layout = tabs
app.run_server(debug=True)
Thanks in advance