diff --git a/daqviewer/daqviewer.py b/daqviewer/daqviewer.py index 95470a6..d3c2070 100644 --- a/daqviewer/daqviewer.py +++ b/daqviewer/daqviewer.py @@ -81,8 +81,12 @@ def parse_contents(contents, filename, date): trace = go.Scatter(x=df.index, y=df[col], name=col, opacity=0.8) ts.append(trace) - layout = dict(title=basename, xaxis=dict(rangeslider=dict())) - timeseries = dict(data=ts, layout=layout) + layout = {'title': basename, 'xaxis': {'rangeslider': {}}} + graph_timeseries = dcc.Graph(id='time-series', + figure={ + 'data': ts, + 'layout': layout + }) # Create spectral dataframe dfs = pd.DataFrame(columns=range(15)) @@ -109,7 +113,7 @@ def parse_contents(contents, filename, date): trace = go.Scatter(x=S.args, y=S.data, name=col, opacity=0.8) spec.append(trace) - energy = dict(data=spec) + graph_energy = dcc.Graph(id='energy-spectrum', figure={'data': spec}) # Add location column dfs['location'] = dfs.index @@ -122,7 +126,7 @@ def parse_contents(contents, filename, date): } # Add table - table = dash_table.DataTable( + table_energy = dash_table.DataTable( id='datatable-row-ids', columns=[{ 'name': [val, key], @@ -144,8 +148,7 @@ def parse_contents(contents, filename, date): ) elements = html.Div([ - dcc.Graph(id='time-series', figure=timeseries), - dcc.Graph(id='energy-spectrum', figure=energy), table, + graph_timeseries, graph_energy, table_energy, html.Div(id='datatable-row-ids-container') ])