Here you are passing “dff2” as the data_frame but for both x and y values you are using the original “df”. The reason your graph is not updating is because you are not using the data from dff2 in your fig.
I’ve change the type of chart. i am using bar chart and i’ve add 3 chart. i make the dropdown of customer group and product type responsive based on currency dropdown. but i got an error that ErrorType / NoneType because i am using isin. what should i do?
the third chart is also not responding well.
this is the new code… can u have a look and teach me how to fix this?
The NoneType error is fired as initially when the app is loaded your dropdowns have no value in them so the isin condition checks for None value. You could solve this by checking if the variables holding the dropdown values are not None before creating the df.
Like this:
if all(v is not None for v in [value_currency, customer_group, product_type]):
dff = df1[(df1['Customer_group'].isin(customer_group)) & (df1['Currency.Currency'].isin(value_currency)) & (
df1['Product_Type'].isin(product_type))]
# print(dff)
fig = px.histogram(data_frame=dff, x='Currency.Currency', y=['Sales Amount', 'Cost_Amount'], barmode='group',
height=400)
return fig
else:
return {
'layout':{}
}
And regarding the chart 3 I tried to print the dff3 for your chart 3 and it returns an empty dataframe. It’s due to the incorrect order of inputs to your callback function.
The input variables to the chart_tiga function should be in the same order you write your inputs in the callback.