✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Scrollable bar chart or workarounds?


I’m trying to implement a horizontal bar chart in Plotly with the chart scrollable only along the axes. Is this possible?

From other posts I learned that we can have a large sized graph and set CSS overflow on the graph wrapper, but I guess this is just scrollability on the whole graph (including titles, legends etc.), and you still have to scroll a lot to find the axes positioned on the very bottom/left.

I’ve also looked at the rangeslider option but I guess it is not yet available for the y-axis, which what I need for my horizontal chart. The reason I want it to be horizontal is that I may have pretty long texts on the category axis, so I prefer to make them horizontally readable. But so far I’m not able to find an approach to set a rangeslider on the y-axis.

What I expect is to have a chart only scrolling on the axes, which means a relatively smaller sized chart with axes easily reachable but still not pretty stacked and unreadable when there are too many categories. I know that zooming+panning is a workaround, but my team don’t think it’s optimal because it still makes the chart ugly when initialized. Setting initial range on the axis brings us back to the rangeslider issue because we want to let the user know the initial range is not the whole, and again we can’t use it on the y-axis.

Is there any better way to have scrollability or similar behavior on a bar chart? Thanks in advance!