我是编程界的新手,作为第一项任务,我被派去创建一个应用程序,我在fronted NextJs和Fastapi中使用它作为api。目前,我想用plotly制作一个交互式图形,这是我通过链接中的以下代码实现的:dash/graph/{id_file}
@app.get("/graph/{id_file}", name="Return the graph obtained")
def create_graph(id_file: str):
data = HAR.preparaDatos(id_file)
dataFinal = HAR.dataYprediccion(data, 'routes/modelo.h5')
fig = px.scatter(dataFinal, x=dataFinal['dateTimes'], y=dataFinal['nameActivities'])
app_dash = dash.Dash(__name__, requests_pathname_prefix='/dash/')
app_dash.layout = html.Div(children=[html.H1(children='Activity performed'),
html.Div(children='''In this graph you can see the activity performed.'''),
dcc.Graph(id='example-graph',figure=fig)
])
app.mount("/dash/", WSGIMiddleware(app_dash.server))
此url中的结果是: Graph that i want to show in my fronted
然而,我想要的是这个相同的图形将它作为一个元素传递给我的带有nextjs的fronted并显示它,有人知道我怎么做吗
目前没有回答
相关问题 更多 >
编程相关推荐