I have two stacked bar charts one aggregated by decade the other showing the annual data. As you hover over the decade categories I want the annual chart to be highlighted for the 10 years and for the category selected.( here represented by the five boroughs of New York City). My problem is that the selected category is appearing at the top of the 10 annual columns instead of highlighting the category in the annual chart.
My code for the update after hover: df3 original data df5 data for borough and decade hovered over on decade stacked bar.
fig1 = go.Figure()
# Create list of all unique sub categories
sub_categories = df3['Borough'].unique()
# Adding bars for each sub-category
for sub_cat in sub_categories:
filtered_df = df3[df3['Borough'] == sub_cat]
fig1.add_trace(go.Bar(
x=filtered_df['Year'],
y=filtered_df['Units'],
name=sub_cat
))
fig1.add_trace(go.Bar(
x=df5['Year'],
y= df5['Units'],
marker=go.bar.Marker(
color='rgb(255,0, 255)'
)
) )