You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to create a workable example to solve this community question, but I could only make it work with another dcc component inside. Here is the example:
import time
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
loading_component = html.H1(
style={},
children='Loading...'
)
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Input(), # callback doesn't work without this line
html.Div(id='live-graph-container', children=[
loading_component
]),
# Arbitrary element to fire the callback below
html.P(
id='trigger-live-chart',
children=''),
])
@app.callback(Output('live-graph-container', 'children'),
[Input('trigger-live-chart','children')])
def generate_live_chart(_):
time.sleep(3) # simmulate 3 seconds of data processing
return dcc.Graph(
id='live-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
if __name__ == '__main__':
app.run_server(debug=True)
If you remove that dcc.Input() line, the program still runs, but you are just stuck with the loading text. Is this happening for others when they try to use it, or just me? Any thoughts on why this is occurring?
For reference, here are my plotly related packages version:
Seems like the work around is very simple, but good to know that this issue exists. Perhaps adding an exception that parses the layout after parsing callbacks would be a nice warning to print out for those not in the know.
I was trying to create a workable example to solve this community question, but I could only make it work with another dcc component inside. Here is the example:
If you remove that
dcc.Input()
line, the program still runs, but you are just stuck with the loading text. Is this happening for others when they try to use it, or just me? Any thoughts on why this is occurring?For reference, here are my plotly related packages version:
The text was updated successfully, but these errors were encountered: