Plotly.js: Disabling zooming and panning

Created on 2 Dec 2015  ·  11Comments  ·  Source: plotly/plotly.js

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.

Most helpful comment

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.

All 11 comments

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.

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

@buremba All good :beers: It is a pretty hidden feature.

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.

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

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

@etpinard Thanks :)

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

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.

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?

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

@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

https://github.com/plotly/plotly.py/issues/1074

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pynklu picture pynklu  ·  3Comments

maxwell8888 picture maxwell8888  ·  3Comments

deecay picture deecay  ·  3Comments

nicolaskruchten picture nicolaskruchten  ·  3Comments

mithi picture mithi  ·  3Comments