Hi,
I use the dcc.Store Component in my Dash. The idea is to store DB-Data for a Graph-Components.
Here the declaration:
app.layout = html.Div(
[
# The memory store reverts to the default on every page refresh
dcc.Store(id='memory', storage_type = 'memory'),
# header
html.Div(
[
I read the Data in a callback and store the Data:
@app.callback(Output('memory', 'data'),
Input("steam-update", "n_intervals"),
State('memory', 'data'))
def gen_global_dataframe(data):
dt_start = datetime.now() + timedelta(hours=-1)
dt_end = datetime.now()
Fabrik = '001F30120E.PV'
data = get_steam_data(dt_start, dt_end, Fabrik)
return data.to_dict('records')
How can I read the Data from Storage into a DF in a second callback? I try this here, but df is empty…?
@app.callback(
Output("steam-graph", "figure"),
Input("steam-update", "n_intervals"),
State('memory', 'data')
)
def gen_steam_consumption(interval, data):
df = data
....
Regards
Torsten