-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Plotly on Mobile - page scrolling #2844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
plotly.js disables scroll zoom by default, so I'm a little puzzled by this report. Are you referring to graphs on plotly cloud's shareplot view (e.g. https://plot.ly/~etpinard/7609)? Alternatively, this might be a side-effect of #2371 |
Or perhaps, you're referring to 3D or/and geo subplots that indeed have no way to disable zoom at the moment, ref #143 |
Hi Étienne, Thank you for prompt response. Is it possible to change scroll zoom settings dynamically? On mobile device I want to have scroll zoom enabled by default, and on desktop – disabled. |
You could use a package like https://www.npmjs.com/package/has-hover to determine if you're on desktop or mobile then var hasHover = require('has-hover')
Plotly.newPlot(gd, [/**/], {/**/}, {
scrollZoom: !hasHover
}) |
@maverick-2 did #2844 (comment) solve your issue? Would it be ok if we closed this ticket? Thank you. |
Étienne, I set scrollZoom to true, then to false, but did not notice any change in behaviour. When I swipe on the bar aria, the default behaviour of the chart is ZOOM, but I need the chart just to be scrollable together with the web page. |
I think I have the same problem as @maverick-2 . The problem is when you use your finger to move up or down on the page (I think the word "scrolling" caused confusion here) and you touch a chart the chart will hijack the touch event and start to zoom instead of letting the user move up/down on the page. @etpinard I tried your hasHover suggestion. To fix this, I put the following code into the layout
BUT the problem now is that when a user tries to move around on the page plotly still captures the touch event and you can't move around (although the zooming is gone). This is especially problematic when the chart fills most of the screen. There needs to be a differentiation between a simple touch and a hold-and-drag. Any idea how to fix this? EDIT: |
Thanks @chriggi for trying to clarify the issue! From what I'm seeing (more precisely on https://plot.ly/javascript/line-and-scatter/ ), dragging up and down (good call not calling this motion a scroll) on the plot area (i.e. within the plot's axes) does try to mimic the desktop's zoombox, but dragging up and down outside the plot area moves the page up and down. In other words, plotly.js only "hijacks" touch events on the plot area. Can anyone confirm this? On https://plot.ly/javascript/disable-zoom/#disabling-zoom-events-for-x-and-y-axis, @chriggi is correct, dragging up and down on the plot area does nothing, and arguably we shouldn't try to catch those "long" touch events when all axes are fixed. As a workaround, I'll suggest making a fully static graph. For example, on https://plot.ly/javascript/configuration-options/#making-a-static-chart you should be able to move up and down the page by dragging up and down on the plot area. Alternatively, we should perhaps consider adding a |
I can confirm this. To clarify: dragging on the axes moves the chart, dragging on the plot itself zooms and dragging outside moves the page (as expected). |
Hi @etpinard, 21% of Internet traffic to our site is coming from mobile devices, so it is highly desirable to have mobile-friendly charts. |
That'd be great! Can you tell, when will it be implemented? We have to calculate, whether its cheaper to wait or rollback to ancient plotly 1.17 |
Is the option staticPlot available on Python too? I was trying with e.g.
but it seems that neither the keywords (static_plot, staticplot, staticPlot) is not known. |
@etpinard |
Thank you for integrating the option "dragmode" in the layout. Starting from v1.43.0 it works as supposed. |
@maverick-2 is this still an issue? |
This issue has been tagged with A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort. Sponsorship range: $5k-$10k What Sponsorship includes:
Please include the link to this issue when contacting us to discuss. |
This thread really helped me. I ran into the same issue and dragmode=False allowed correct webpage scrolling. However, when using this flag, clicking on a scatter plot item to show the annotation results in a short highlight (light shade) of the overall graph. This visual highlight of the graphs rectangle is pretty disturbing. Any suggestions how to avoid this? |
@janvv Did you ever find a solution to the highlight issue you mentioned? I'm running into the same problem after setting dragmode to false. |
@janvv I found a hacky solution- It seems the flash of highlight occurs because there is a |
I've had the same problem and I noticed that |
Hi developers,
I have troubles scrolling a page with bar chart on mobile devices. The chart’s default behaviour is zooming. It makes page scrolling impossible, unless label area is used for that. This is not intuitive, and confusing for users.
Is there a way to switch off zooming behaviour, and enable normal scrolling instead. Other libraries do that, for example:
https://www.highcharts.com/
I understand that pinch/zoom and other mobile stuff is work in progress, but can you enable at least simple page scrolling??
Thank you!
The text was updated successfully, but these errors were encountered: