plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js
https://dash.plot.ly/cytoscape
MIT License
597 stars 120 forks source link

[Feature request]: Panzoom extension #83

Open vasabi8 opened 4 years ago

vasabi8 commented 4 years ago

Hi Unfortunately, I did not find Panzoom integration with Dash. This extension creates a widget that lets the user pan and zoom/ It would be nice to add this feature.

If someone has already integrated this extension, please share a solution.

Thanks, Vasyl

xhluca commented 4 years ago

@vasabi8 Have you tried using a dash callback to link a slider or a button that would let you control the zoom level? e.g.

n = 0.1  # Change this for scale
@app.callback(Output("cytoscape", "zoom", [Input("my-slider", "value")])
def update_zoom(slider_value):
  return n * slider_value
Melclic commented 2 years ago

@xhlulu I tried your suggestion and it does work. However, it seems like it zooms on the upper left corner. And since the user cannot add his own pan values I can't seem to figure out how to fix that