I’m working with Plotly and Dash to create a stacked area chart, and I need the legend to have a fixed width with horizontal scrolling. I have a large number of legend items, and I want to avoid the legend wrapping to the next line, instead enabling a horizontal scroll bar.
Here is a simplified version of my code:
area_empilhada_year = px.area(df_tax_year, x='year', y='value', color=tax)
I want the legend to appear in a single line and have a horizontal scrollbar if it exceeds the fixed width.
Is there a way to achieve this in Plotly and Dash?
PS: Suggestions including Dash-specific solutions are also welcome.
Current Graph Screenshot:
I tried updating the legend configuration in Plotly Dash to have a fixed width and enable horizontal scrolling. I expected the legend to appear in a single line with a scrollbar if it exceeded the fixed width. However, the legend items still wrapped to the next line instead of enabling horizontal scrolling.