Plotly-Dash not showing list of graph elements

  arrays, html, plotly, plotly-dash, python

If I place dcc.Graph elements hardcoded in the layout:

app.layout = html.Div(
    html.Div([
        dcc.Graph(id='graph-hammer'),
        dcc.Graph(id='graph-saw'),
        dcc.Interval(id='interval-component', interval=1000, n_intervals=0)]))

I get my desired result of 2 graphs plotted without problems.

But if I create a list of dcc.Graph elements using append:

list_graphs = []
for t in tools:
    list_graphs.append(html.Div(dcc.Graph(id='graph-' + t)))

app.layout = html.Div(
    html.Div([
        list_graphs,
        dcc.Interval(id='interval-component', interval=1000, n_intervals=0)]))

I get a blank screen.

What am I doing wrong when passing the list to the layout?

Source: Python Questions

LEAVE A COMMENT