1

I have seen lots of answers but the whole concept of callbacks kind of throws me off (still early in my python journey)

My goal is just to make a graph that add many different indicators at the same time as opposed to separate graphs.

Below is a quick example of the code but it will not return the graph itself, even though the drop down does work and has every label. Is my issue in the input, the output, the id's, etc?

Thanks in Advance!

app = JupyterDash(__name__)

layout_home = html.Div(style={'height':'100vh'},children=html.H2('HOME PAGE'))
    


layout_page_1 = html.Div([
    dcc.Dropdown(id='demo-dropdown', options = [ {"label": "Bitcoin", "value": "ohlcfig"},
                     {"label": "Ethereum", "value": "fig2"},
                     {"label": "Dogecoin", "value": "fig3"}] , multi = True),
    html.Div(id='dd-output-container')
])


@app.callback(
    Output('dd-output-container', 'children'),
    Input('demo_dropdown', 'value')
)
def build_graph(value):
    if value == 'Bitcoin':
        return ohlcfig
    elif value == 'Dogecoin':
        return fig2

if __name__ == '__main__':
    app.run_server(debug=True, port=5000)
  • The goal is for it to work like Trading View or any other chart site/app. I have all the indicators and data in place such as Moving Averages, RSI, etc set in each fig, I just cant get them to show up in the dashboard. – Kenneth Lott Jun 01 '22 at 18:21

1 Answers1

0

Two main reasons here mate.

  1. your id is demo-dropdown and in your callback you have put demo_dropdown (_ instead of -)

  2. the main reason why nothing happens here is that your 'value' is never 'Bitcoin', here your values are ohlcfig, fig2 and fig3, Ethereum, Dogecoin and Bitcoin being here the labels.

Hop this helped

Ces
  • 76
  • 1
  • 7