开发者

How to add drop down to my line chart in dash based on a column in dataframe?

开发者 https://www.devze.com 2022-12-07 19:38 出处:网络
I have cleaned the dataframe and plotting these graphs on plotly and work fine on Dash. I want to insert a dropdown for x-axis (i.e, Y and P for both the graphs separately). I am trying with dcc.dropd

I have cleaned the dataframe and plotting these graphs on plotly and work fine on Dash. I want to insert a dropdown for x-axis (i.e, Y and P for both the graphs separately). I am trying with dcc.dropdown but it's not working.

I have been trying with this but am confused about the dcc dropdown. Any help would be appreciated, I am new to Dash!

fig1 = px.line(df_1, x='Y',y=['x','y']) fig2 = px.line( df_2, x='P',y=['x','y'])

`app.layout = html.Div(children=[ # All elements from the top of the page html.Div([ html.H1(children='...'),

    html.Div(children='''
       '''
    '''),

    dcc.Graph(
        id='graph1',
        figure=fig1
    ),  
]),
# New Div for all elements in the new 'row' of the page
html.Div([
    html.H1(children=''),

    html.Div(children=''' 
        
    '''),

    dcc.Graph(
        id='graph2',
    开发者_StackOverflow    figure=fig2
    ),  
]),

])

if name == 'main': app.run_server(debug=True, use_reloader = False)`

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号