Commit a3b1ae67 authored by Samuël Weber's avatar Samuël Weber
Browse files

do not use Store

parent cafe8695
......@@ -20,7 +20,6 @@ NCLICKED = 0
layout = dbc.Container(
id="container-results",
children=[
dcc.Store(id='memory-op'),
dbc.Row([
dbc.Col(
id="upload-col",
......@@ -87,23 +86,25 @@ layout = dbc.Container(
html.Div(
id='output-data-op',
children=[
dash_table.DataTable(
id="datatable-op",
sort_action="native",
sort_mode="multi",
filter_action='native',
page_size=5,
export_columns='all',
export_format="xlsx",
style_cell={
'overflow': 'hidden',
'textOverflow': 'ellipsis',
'maxWidth': 0,
},
),
dcc.Loading(
dash_table.DataTable(
id="datatable-op",
sort_action="native",
sort_mode="multi",
filter_action='native',
page_size=5,
export_columns='all',
export_format="xlsx",
style_cell={
'overflow': 'hidden',
'textOverflow': 'ellipsis',
'maxWidth': 0,
},
),
)
]
),
className='col-9'
className='col-10'
),
],
className="justify-content-center"
......@@ -196,25 +197,6 @@ def update_output(content, name, clicked):
)
return (data, columns, flash)
@app.callback(Output('memory-op', 'data'),
[
Input('datatable', 'derived_virtual_data'),
Input('option-OPtype', 'value'),
])
def update_storage(dfpm, OPtype):
if dfpm is None or len(dfpm) == 0:
raise PreventUpdate
dfpm = pd.DataFrame(dfpm)
dfpm["Date"] = pd.to_datetime(dfpm["Date"])
dfop = pyOPestimator.get_op_from_pm10(dfpm, OPtype)
factors = list(dfop.drop(["Date", "month", "PM10", "totalOP"], axis=1).columns)
# dfop = dfop.melt(id_vars=["Date", "totalOP", "month", "PM10"], var_name="Factor",
# value_name="OP")
return dfop.to_dict('record')
@app.callback(Output('graph-abs', 'figure'),
[
Input('datatable', 'derived_virtual_data'),
......@@ -275,14 +257,21 @@ def update_graph(dfpm, OPtype, temporality):
Output('datatable-op', 'columns')
],
[
Input('memory-op', 'data')
Input('datatable', 'derived_virtual_data'),
Input('option-OPtype', 'value'),
],
[
State('option-OPtype', 'value'),
]
)
def add_op_to_datatable(dfop, OPtype):
df = pd.DataFrame(dfop)
def add_op_to_datatable(dfpm, OPtype):
if dfpm is None or len(dfpm) == 0:
raise PreventUpdate
dfpm = pd.DataFrame(dfpm)
dfpm["Date"] = pd.to_datetime(dfpm["Date"])
dfop = pyOPestimator.get_op_from_pm10(dfpm, OPtype)
factors = list(dfop.drop(["Date", "month", "PM10", "totalOP"], axis=1).columns)
df = dfop.copy()
df["Date"] = pd.to_datetime(df["Date"])
df["total_{}".format(OPtype)] = df["totalOP"]
df.drop("totalOP", axis=1, inplace=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment