Setting data from Javascript

I have a Bokeh chart with some points on it, and I’d like to be able to select some of those points and preview information about them using Streamlit. It’s not hard to add a JS click handler to Bokeh that can get the information I need, but after that I’m not sure how to get it back to Streamlit.

Example: Each of the points on my Bokeh plot has an ID associated with it. I click a few points in Bokeh and then I want to send those IDs to Streamlit, read info from a database, and show it in a table under the chart.

I tried setting the value of a text input field, but it doesn’t trigger any Streamlit events, and clicking on it in the UI removes the content.

Is there a good way to do this?

Hi @polm! Welcome to the forums :wave:

Right now it’s not possible to grab data like selected points from a chart in a Streamlit app. We’re actually working right now on an API design to support that, but my guess is it will be a couple of months before we’re able to release it.

If you’d like to follow the progress on this work, please subscribe to the issue here:

1 Like

Thanks, good to know I wasn’t missing something at least.

Is there a workaround to add Javascript in the dom of a Streamlit App ?
Even just add a script in the html header and do dirty stuff in JS ?