Hi Emil, Thanks for the reply.
I understand the process of triggering callbacks with intervals and updating the state of the component. However I am not sure what you mean when you refer to using a file or redis cache.
In this case, There are LED icons, when the user clicks on one, it updates the histogram graph (displays LED name and past activity). The function definition looks like this
@app.callback(
[
Output("histogram-graph", "figure"),
Output("store-data-config", "data"),
Output("histogram-title", "children"),
],
[
Input("interval", "n_intervals"),
Input("SatStore", "data"),
Input("control-panel-toggle-minute", "value"),
Input("control-panel-elevation", "n_clicks"),
Input("control-panel-temperature", "n_clicks"),
Input("control-panel-speed", "n_clicks"),
Input("control-panel-latitude", "n_clicks"),
Input("control-panel-longitude", "n_clicks"),
Input("control-panel-fuel", "n_clicks"),
Input("control-panel-battery", "n_clicks"),
],
[
State("store-data", "data"),
State("store-data-config", "data"),
State("histogram-graph", "figure"),
State("store-data-config", "data"),
State("histogram-title", "children"),
State("SatStore", "data"),
],
)
def update_graph(
interval,
satellite_type,
minute_mode,
elevation_n_clicks,
temperature_n_clicks,
speed_n_clicks,
latitude_n_clicks,
longitude_n_clicks,
fuel_n_clicks,
battery_n_clicks,
data,
data_config,
old_figure,
old_data,
old_title,
sat_type2,
):
new_data_config = data_config
info_type = data_config["info_type"]
ctx = dash.callback_context
#print('Graph Update Triggered')
# Check which input fired off the component
if not ctx.triggered:
trigger_input = ""
else:
trigger_input = ctx.triggered[0]["prop_id"].split(".")[0]
...
elif trigger_input == "control-panel-speed":
set_y_range("speed")
info_type, new_title = update_graph_data("speed")
...
return [figure, new_data_config, new_title]
I can save the return data when the callback is fired, and send it to all connected clients. But where do I save it?