streamlit-vega-lite icon indicating copy to clipboard operation
streamlit-vega-lite copied to clipboard

Register Click for Entire Chart Object

Open Murtz5253 opened this issue 5 years ago • 4 comments

Is there any way to use this package to register a click for an entire chart object? I am building an app using Streamlit, and I want my user to be able to select from a choice of charts, and I want to record the selected chart to the back-end. Currently, it seems like I can only get specifically selected data from the charts, but I want to capture a click on the entire chart itself.

Murtz5253 avatar Nov 17 '20 05:11 Murtz5253

You might be able to create a signal that triggers when the chart is clicked.

The easier solution would be to a way to register event listeners from Python. On the view, you could then set the listener with https://vega.github.io/vega/docs/api/view/#view_addEventListener.

Do you want to send a pull request to add this feature?

domoritz avatar Nov 17 '20 15:11 domoritz

I would like to, yes, but I am still a bit confused at how the source code for this extension functions. In fact, when I try to run the example usage in the README, nothing gets printed out underneath the chart.

Murtz5253 avatar Nov 18 '20 03:11 Murtz5253

Does https://share.streamlit.io/domoritz/streamlit-vega-lite-demo/main/demo.py work?

domoritz avatar Nov 18 '20 04:11 domoritz

That one works, yes.

Murtz5253 avatar Nov 18 '20 04:11 Murtz5253