Here is something that will display everything in one shot. Overall time is the same.
What I did is applying said delay to all elements of the page.
Delay is caused by plotly/size of df. I do not know how to shorten it.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
import numpy as np
import time
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
app.layout = html.Div(id='main',
children=[
html.H1(id='trigger', children='Hello Dash',),
html.Div(children=['''Dash: A web application framework for Python.''']),
html.Div([dcc.Graph(id="output-2")], )
],
style={'display':'none'}
)
@app.callback([Output("output-2", "figure"),
Output('main', 'style')],
Input("trigger", "value"))
def input_triggers_nested(value):
df= pd.DataFrame(np.random.randint(0,100,size=(400000, 8)), columns=list('ABCDEFGH'))
fig = px.scatter(df, x="A", y="E", width=1000)
return fig, {'display':'block'}
if __name__ == '__main__':
app.run_server(debug=True)
Code is not clean, but idea is there. You can put loader back on - I forgot to do so 