nline / nline-plotlyjs-panel

Plotly.js for Grafana
https://grafana.com/grafana/plugins/nline-plotlyjs-panel/
Apache License 2.0
37 stars 3 forks source link

Set TimeRange/TimeTicker based-off selected plotly range #41

Open nharper-usgs opened 2 weeks ago

nharper-usgs commented 2 weeks ago

Hi!

I was wondering if it'd be possible to implement the ability for a graph (or at least a 2d cartesian graph) to set the time range for the entire dashboard (via the timeticker) by selecting and dragging a time range on the plotly panel.

This would be similar to how all of the default/built-in panels currently update the time ranges for all the displayed panels.

jacksongoode commented 2 weeks ago

Just whipped up an example. We needed to make more of the Plotly events available. For this, each Plot has a toggle that determines whether it would change the dashboard range.

https://github.com/user-attachments/assets/b0465605-be28-46af-a5ad-8508ef39915d

image

Is this what you imagined?

nharper-usgs commented 2 weeks ago

Yes! This is amazing. I'd done some crazy logic with event handlers in the initialized script, but it required a page refresh. I was literally grabbing the new Xs from the plotly_relayout event and refreshing the page url with new from/to variables.

Let me know when you're able to build a new release!