0
Hi I am new to Dash Plotly, Based on the dropdown I am loading graphs. So i have a callback function which returns data. How do I go about sending that data to the graph?
Dropdown:
dcc.Dropdown(
id='dropdown',
options=[
{'label':'Production', 'value':'prod'},
{'label':'Attrition', 'value':'attri'}
],
multi=True,
value="MTL",
)
Call Back
@app.callback(Output(‘output’, ‘children’),
[Input(‘dropdown’, ‘value’)])
def update_output_1(value):
if value == ‘prod’:
cur.execute(
"select distinct extract(year from last_hire_date) as yr, "
“count(*) from associate_info group by yr order by yr ASC”)
trend = cur.fetchall()
x_trnd, y_trnd = zip(*trend)
x_trnd = list(x_trnd)
y_trnd = list(y_trnd)
x_t = [int(i) for i in x_trnd]
y_t = [int(y) for y in y_trnd]
return x_t, y_t
elif value== ‘attri’:
return len(value)
else:
return value