Open jrieke opened 5 months ago
To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.
Your vote helps us identify which enhancements matter most to our users.
I would love to see this implemented. I started using Streamlit yesterday and was looking for ways to connect events from Plotly charts to drive other components.
My use case involves segmenting and feature detection of flight data. Plotly is very convenient for plotting the various parameters needed for analysis. It would be extremely helpful to be able to zoom in on parts of the Plotly graphs and have a second Pydeck component automatically update to display the corresponding portion of the flight path. This would allow for easy cross-referencing between pydeck and plotly, which I currently cannot achieve.
Checklist
Summary
We will soon add selections to charts (
st.plotly_chart
andst.altair_chart
). At some point, we should also add a way to react to zoom/pan events on charts and return the bounding box of the displayed chart.Why?
Let us know in the comments if you have specific use cases in mind!
How?
We should probably add a new event parameter (e.g.
on_zoom_pan
oron_relayout
oron_move
). Or we could think about integrating it withon_select
in some way (which would make the implementation a lot easier but might be a bit less obvious from UX perspective).Additional Context
Altair already supports this via selections events: using
.interactive()
in Altair adds a selection interval event (https://altair-viz.github.io/user_guide/interactions.html#scale-binding) and is a shortcut foralt.selection_interval(bind='scales')
. You can use that to get the area the user is currently viewing.