当尝试使用以下代码生成图形时
@app.callback(
[
Output("selected-plot", "figure")
],
[
Input("submit-selected-plotting", "n_clicks"),
State("table", "data")
],
)
def plot(button_clicked, data)
fig = go.Scatter(x=data["index"],
y=data["result"],
mode='lines',
name='result')
return fig
Run Code Online (Sandbox Code Playgroud)
和
dbc.Col(
[
dcc.Graph(id='selected-plot')
],
width=6,
)
Run Code Online (Sandbox Code Playgroud)
我收到一个奇怪的错误,应用程序期待不同的对象:
dash._grouping.SchemaTypeValidationError:架构:[<Output
selected-plots.figure>] 路径:() 预期类型:(<class 'tuple'>,<class 'list'>) 收到类型 <class 'plotly.graph_objs._scatter.Scatter' 的值>: 分散({...})
我已经尝试了一切,但似乎无法解决这个错误。感谢您提前提出任何建议!