So I am trying to run a callback based from an interval and I get the error KeyError: “Callback function not found for output ‘…x_trace.data…y_trace.data…’, perhaps you forgot to prepend the ‘@’?”
What I am trying to do is take a stream of hex data with measurements in different directions xy and z. and plot them. I have tried other ways like splitting them into different callbacks but it only runs the first one. Any thoughts or idea would be greatly appreciated.
My callback which definitely has the @.
@app.callback([Output('x_trace','data'), Output('y_trace','data')],Input('xplot-update','n_intervals'))
def get_x_data(interval):
global archive
start=now-timedelta(minutes=10)
pvals=archive(start=start, stop=now)
x=[]
y=[]
for pval in pvals:
x1=int(pval.raw_value.hex()[16:20],16)
y1=int(pval.raw_value.hex()[20:24],16)
x.append(x1)
y.append(y2)
return x,y
I have the plotting down right so that is covered.
app.layout = html.Div([
dcc.Interval(id="xplot-update", interval=1000, n_intervals=0,),
html.Div([html.H6("X component", className="graph__title")]),
dcc.Graph(id="xplot", figure=dict(layout=dict(plot_bgcolor=app_color["graph_bg"],
paper_bgcolor=app_color["graph_bg"],)),),
html.Div(id='x_trace',style={'display':'none'}),
html.Div([html.H6("Y component", className="graph__title")]),
dcc.Graph(id="yplot",figure=dict(layout=dict(
plot_bgcolor=app_color["graph_bg"], paper_bgcolor=app_color["graph_bg"],)),),
html.Div(id='y_trace',style={'display':'none'}),
],)