Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Callback failed: the server did not respond

Hi everyone,

This is my first time using Dash. I am still running my codes on my PC yet I am unable to see any result.

I am trying to create time series plot using chained callbacks whereby the first callback selects a data frame from a dictionary of data frames while the second callback will choose a variable in the selected data frame which will be plotted. Please, I will be grateful if someone can help me debug my code. Thanks in advance.

dataFrames = combineFiles (path) # function to create dictionary of data frames

external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = dash.Dash(name, external_stylesheets=external_stylesheets)

app.layout = html.Div(
[
dcc.RadioItems(id=‘Dataset-radio’,
options=[{‘label’: k, ‘value’: k} for k in dataFrames.keys()],
value=‘waterIntake’),

 html.Hr(), 
 
 dcc.RadioItems(id='Variable-radio'), 
 
 html.Hr(),
 
 html.Div(id='display-selected-values'),
      
 dcc.Graph(id='indicator-graphic'),


])

@app.callback(
Output(‘Variable-radio’, ‘options’),
[Input(‘Dataset-radio’, ‘value’)])
def set_variable_options(selected_data):
return [{‘label’: i, ‘value’: i} for i in dataFrames[selected_data]]

@app.callback(
Output(‘Variable-radio’, ‘value’),
[Input(‘Variable-radio’, ‘options’)])
def set_variable_value(available_options):
return available_options[1][‘value’]

@app.callback(
Output(‘display-selected-values’, ‘children’),
[Input(‘Dataset-radio’, ‘value’),
Input(‘Variable-radio’, ‘value’)])
def set_display_children(selected_data, selected_factor):
return u’{} is a variable in {} dataset’.format(selected_factor, selected_data,)

@app.callback(
Output(‘indicator-graphic’, ‘figure’),
[Input(‘Dataset-radio’, ‘value’),
Input(‘Variable-radio’, ‘value’)])
def update_graph(dataset, variable):
df = dataFrames[dataset]
fig = px.line(df,x=df.index,y=df[variable])
fig.show()
return fig

if name == ‘main’:
app.run_server(debug=True)