ae3e / ae3e-plotly-panel

Plotly panel for Grafana
Apache License 2.0
98 stars 22 forks source link

A way to return current x,y and zoom level #35

Closed HenrikRolandHansen closed 2 years ago

HenrikRolandHansen commented 3 years ago

Is there a way to return the users current map position(lat, lon) and zoom level within the Java script in the plotly plugin. I would be nice to keep the current map as set from the user even if the data is refreshed or a other time period is selected.

I found this code part https://community.plotly.com/t/get-data-for-current-zoomed-in-view/7092 ​but can't get it to work. Any ideas would be appreciated

var gd = document.getElementById('graph') var xRange = gd.layout.xaxis.range var yRange = gd.layout.yaxis.rang

HenrikRolandHansen commented 2 years ago

Add the following in layout and the map keeps the user zoom level and position { "uirevision": true }