Hi,
I just start to learn dash and plotly to build a web app for collecting data from +20 sensors and update the graph. I need to add a text- or label-box, and update it with the last read values from sensors for each subplot(some of the two traces). Please check the photo. I could not find a way to do it dynamically. Do you have a suggestion about that. Thanks
For simplicity I removed unnecessary parts of my code
.................
fig = make_subplots(rows=grid_row, cols=grid_col, subplot_titles=subplot_titles, specs=secondY_spec,
horizontal_spacing=0.06, vertical_spacing=0.03)
........
for ids, (ch_name, graph_num, y_2ax_val) in enumerate(zip(f_chan_names, f_graph_nums, f_y_2ax)):
.............
fig.add_scatter(x=x_data, y=data[ids], col=(graph_num % grid_col) + 1, row=(graph_num // grid_col) + 1, name=f'<b>{ch_name}</b>', secondary_y=second_y_cond, opacity=opacity_val)
app.layout = html.Div([
.....................
dcc.Graph(id="graph", figure=fig),
..................])
@app.callback(Output("graph", "extendData"),
Input("interval_comp", "n_intervals"), )
def update(n_intervals, figure):
.....................
fig_data = [{"x": [[], ], "y": [[], ] }, [*range(filtered_num_channel)], data_size]
fig_data[0]['x'] = [x_data, ] * filtered_num_channel
fig_data[0]['y'] = data #update current daha
.....................
return fig_data
if __name__ == "__main__":
app.run_server()