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)
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')
])

Loading…
Cancel
Save