Hello everyone,
I’m currently working on a Dash application that uses multiple pages and leverages the div+graph structure for rendering. I’ve noticed that the loading time is more than I’d like it to be, and I’m looking for ways to optimize it and make the application load faster.
The application structure is this:
output_spot = [] # there are other lots of list to store graph
# darwing picture
for i in ['spot-A', 'spot-B', ... 'spot-Z',
]:
fig = Function.seasonal_pic_plotly(df, i, width, sorted_bins=sorted_bins)
output_spot.append(dcc.Graph(id='oil-graph-'+str(i),figure=fig, style={'display': 'inline-block'})) # I use a list to store graph
# showing module
layout = html.Div([html.Div(id='main-content', children=[
html.H1('ttitle', className='title', id='title-anchor'),
html.H3(f'spot', className='spot', id='spot'),
*output_spot,
html.H3(f'bias', id='bias'),
*output_bias,
html.H3(f'other bias', id='bias_other'),
*output_other_bias,
html.H3(f'supply', id='supply'),
*output_supply,
]),
])
The drawing function returns the plotly fig. As you can see, the important thing is I need to load lots of graphs, but it seems that dash will load them at the beginning. I need to spend lots of time to load load upon startup. How can I find ways to reduce this loading time? Currently, I have implemented five pages of varieties, and I’m concerned that if I add more varieties, the loading time will further increase.
Thank you in advance!