Skip to content
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

Disabling zooming and panning #59

Closed
buremba opened this issue Dec 1, 2015 · 12 comments
Closed

Disabling zooming and panning #59

buremba opened this issue Dec 1, 2015 · 12 comments

Comments

@buremba
Copy link

buremba commented Dec 1, 2015

I'm aware that there is staticPlot option for disabling these features but it actually disables all interactive operations including tooltips and legends.

For charts that don't have much data points, these features unnecessary so it would be great if you guys add an option to disable zooming, panning and dragging.

@etpinard
Copy link
Contributor

etpinard commented Dec 1, 2015

In svg 2d plots, you can set layout.xaxis.fixedrange: true to disable zooming/panning along x and similarly using layout.yaxis.fixedrange: true in the y direction. More info on the reference page.

That said, this option hasn't been implemented for the webgl and maps plot types yet.

@buremba
Copy link
Author

buremba commented Dec 1, 2015

Oh, I missed them. Thanks for the fast response!

@buremba buremba closed this as completed Dec 1, 2015
@etpinard
Copy link
Contributor

etpinard commented Dec 1, 2015

@buremba All good 🍻 It is a pretty hidden feature.

@ankitgoel888
Copy link

How to do this for tables created via figure factory viz.
ff.create_table(df).
There seems to be no attribute called fixedrange in the output generated via ff.

@etpinard
Copy link
Contributor

How to do this for tables created via figure factory viz.

Please ask your questions on https://community.plot.ly/

@sriram15690
Copy link

@etpinard Thanks :)

@sriram15690
Copy link

I did not find “staticPlot: true” in the attribute reference. It should be added to the documentation.

@sriram15690
Copy link

In svg 2d plots, you can set layout.xaxis.fixedrange: true to disable zooming/panning along x and similarly using layout.yaxis.fixedrange: true in the y direction. More info on the reference page.

That said, this option hasn't been implemented for the webgl and maps plot types yet.

This option disables browser-page optical zoom on tablets when a user tries to zoom the page by placing his fingers on the graph.

@DaveSimmons1234
Copy link

Why does putting xaxis.fixedrange: true, yaxis.fixedrange: true on the graph change the mouse cursor to pointer, as if the whole graph is clickable?

@j-madrone
Copy link

In case anyone comes looking for this feature like I did for Choropleth plots:

  • The option to disable panning: dragMode=False in the layout property
  • The option to disable scrolling: scrollZoom=False in the config property
  • The option to disable map controls: displayModeBar=False in the config property

@surya-factly
Copy link

surya-factly commented Dec 9, 2020

@jaspersardonicus

That was helpful. As far as I understand, in python, we can provide those configuration options to

config = dict({'scrollZoom': False}) fig.show(config = config)

I am using streamlit to show a plotly chart and cannot use the show() function, which opens the choropleth map in new window. Is there any other way we can set these config options.

Any help is appreciated. Thanks

Saw the issue

plotly/plotly.py#1074

@adrian-gralak95
Copy link

For people stumbling, here from the internet - https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js has the reference for all the config options, if you set {'showAxisDragHandles': False} it should do exactly what was asked in the question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants