So i’m looking to make an interactive barchart with a dropdown menu per asset which i will have in my dataframe. Here is a snippet of what my data frame looks like.
Here is the code i’m using to make tehe dashboard, it gives me no error and at the same time does not populate the graph with any data. Any help, or a different soultion would be highly regarded.
dff = df2
======================== Dash App
app = dash.Dash(name)
======================== App Layout
app.layout = html.Div([
html.H1(‘Asset Dashboard’, id=‘title’, style={‘color’: ‘#351e15’, ‘text-align’: ‘center’,
‘margin-top’: ‘20px’}),
dcc.Dropdown(
id=‘Asset_ID’,
options=[
{‘label’: ‘ML01 - MILL’, ‘value’: ‘ML01 - MILL’},
{‘label’: ‘ML01 - PINION SHAFT’, ‘value’: ‘ML01 - PINION SHAFT’},
],
value=‘ML01 - MILL’,
style={‘width’: ‘50%’, ‘margin’: ‘20px auto 0px auto’}
),
dcc.Graph(id=‘bar-graph’, style={‘height’: ‘425px’})
])
@app.callback(Output(‘bar-graph’, ‘figure’), Input(‘inp’, ‘value’))
def get_graph(inp):
figure = go.Figure().add_trace(go.Bar(x=dff['Report Date'],
y=dff['ConditionCode'],
name='Performance Graph',
marker=dict(color='#351e15')))
return figure
if name == ‘main’:
app.run_server()