回调错误更新输出图。破折号股票市场预测代码中的孩子

问题描述 投票:0回答:0

这是导致问题的我的代码,请帮助

Dash Framework - 股票价格可视化演示

将 pandas_datareader.data 导入为 web 导入破折号 将 dash_core_components 导入为 dcc 将 dash_html_components 导入为 html 从 dash.dependencies 导入输入,输出 导入日期时间

首先布局

app = dash.Dash()
app.title = "Stock Visualization"
app.layout = html.Div(children=[
    html.H1('Stock Visualization Dashboard'),
    html.H4('Please enter the stock name'),
    dcc.Input(id="input", value='', type='text'),
    html.Div(id="output-graph")
])

# Second the interaction with the user


@app.callback(
    Output(component_id="output-graph", component_property='children'),
    [Input(component_id="input", component_property="value")],
    prevent_initial_call=True)

def update_value(input_data):
    start = datetime.datetime(2010, 1, 1)
    end = datetime.datetime.now()
    df = web.DataReader(input_data, '', start, end)
    return dcc.Graph(id="demo", figure={'data': [{'x': df.index, 'y': df.Close, 'type': 'line', 'name': input_data}, ], 'layout': {'title': input_data}})


if __name__ == "__main__":
    app.run_server(debug=True)


nothing till is helping and the same problem is happening many times 

在这里输入

python pandas callback plotly-dash stock
© www.soinside.com 2019 - 2024. All rights reserved.