Refactor graph and table elements

master
Dan Howe 5 years ago
parent b6fa9b35c2
commit 857aea677b

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

Loading…
Cancel
Save