DuplicateCallbackOutput

#1

Hi. I am stuck with a Duplicate callback error and i dont know how to get around it.

I am using a drop down to filter which data depending on zones. Can anyone help with a solution.

html.Div([
html.Div([
html.Label(‘SELECT YOUR REGION’),
dcc. Dropdown(id=‘chooseregion’,
options=[
{‘label’: ‘EUR’, ‘value’: ‘EUR’},
{‘label’: ‘AFRICA’, ‘value’: ‘AF’},
{‘label’: ‘ASIA’, ‘value’: ‘AS’},
{‘label’:‘N.AMERICA’,‘value’:‘NA’}

my callback:

@app.callback(
Output(‘Bar_graph’,‘figure’),
[Input(‘chooseregion’,‘value’)])

def update_graph(region_chosen):
filtered_df=Pivot_Month[Pivot_Month[‘Region’]==region_chosen]
data=[]
for i in filtered_df.Region.unique():
Pivot_by_zone = Pivot_Month[Pivot_Month[‘Region’]==i]
traces.append(go.Bar(
x=Pivot_Month[‘Region’],
y=Pivot_Month[‘Amount’],
text=Pivot_Month[‘Region’]))
figure={
‘data’:data,
‘layout’: {
‘title’:‘Data Vizualization’

My error message:

DuplicateCallbackOutput:
You have already assigned a callback to the output
with ID “Bar_graph” and property “figure”. An output can only have
a single callback function. Try combining your inputs and
callback functions together into one function.

#2

Hi @Jason4,

Could you move this question to the Dash forum category? That way the Dash folks will be more likely to see it.

Thanks!
-Jon

#3

Did already. Was a mistake. Response rate from that side is pretty slow.