Plotly/Dash应用程序中的回调错误-Python



我的dash应用程序有这段代码,它应该显示基于下拉菜单的3个图中的一个图(id="图选择器"(。excel文件将每天更新,因此我使用Interval组件:

@app.callback(Output('graph', 'figure'),
[Input(component_id='graph-selector', component_property='value')],
[Input('interval-component', 'n_intervals')])
def update_figures(n):
df = pd.read_excel('/Results.xls')

fig_viability = px.scatter(df, x =...)

fig_diameter = px.scatter(df, x =...)

fig_concentration = px.scatter(df, x =...)

def select_graph(value):
if value == 'fig_viability':
return fig_viability
elif value == 'fig_diameter':
return fig_diameter
else:
return fig_concentration

但它给了我这个错误:

"类型错误:update_figures((接受1个位置参数,但给定了2个">

有人知道怎么解决吗?我肯定把这里的回调顺序/逻辑搞砸了。。

回调有两个输入,但函数签名只有一个参数n;它必须有两个才能匹配输入。因此,您应该将函数签名更改为类似的内容

def update_figures(n, m):

最新更新