Plotly graph captures touch scroll event although zooming is disabled

Viewed 317

I am using Plotly through Python and am trying to make the result mobile-friendly by not capturing events that would otherwise lead to zooming and panning when one touches the screen to scroll.

I'm using plotly.subplots.make_subplots, and the first step must be to let

figure['layout'][f'xaxis{n}']['fixedrange'] = True
figure['layout'][f'yaxis{n}']['fixedrange'] = True

for each n in range(num_subplots).

This is sufficient to disable zooming and panning on mobile as well, but the touch event is still captured, which, in turn, makes it impossible to scroll if one accidentally starts touching the screen on a plot (the resulting behavior being that the browser does nothing at all). This happens on both Android Firefox and Android Chrome.

Is it possible to let the touch event pass through, so the user can scroll on their screen even though they start touching on a plot?

1 Answers

I've just ran into the same issue but with plotly.js using React.

After reading the discussion here, I tried to add dragmode = false to the layout which solves the problem with scrolling on mobile devices. In my project the layout is only modified when a mobile browser is used, otherwise dragmode is left untouched.

My guess is that should work with Plotly in Python as well.

Related