Running Streamlit 1.57.0 on python 3.12 with app running locally.
My app plots 3 different datasources on a scatter plot timeline adding a separate trace for each one. the x axis is type=date and y-axis is linear. The y axis is meaningless in that each data source is plotted at a random y around 1,2, or 3 depending on the source (e.g., source 1 has dots around y=1).
I have set it up so that clicking on any dot results in the full row of data associated with that point is presented as a table below the plot. (I use the event_state return from st.plotly_chart(…) to determine which row to place in the table) This works fine with 3 data sources (3 traces)…but when I go to 4 data sources (4 traces), the event_state returns blank. (NOTE- the hover still works…but the event_state which with 3 traces contained info about the point is now with 4 traces completely empty.)
Even more interesting…when I comment out any of the traces (effectively taking the traces back to 3)…the event_state populates correctly again.
Also its not the amount of points!..I reduced the 4 traces to 10 points each and the event state is still blank.
Hey there, thanks for sharing such a detailed description—super helpful!
It seems likely that you’re running into a known limitation or bug with Streamlit’s Plotly integration, specifically with the selection event state when using multiple traces. According to the Streamlit Plotly chart docs and several community reports, the event_state (selection state) can sometimes fail to populate when the chart structure gets more complex, such as adding a fourth trace. This is not related to the number of points, but rather the number of traces or possibly how Plotly’s event system interacts with Streamlit’s frontend.
My understanding is that this is a bug or limitation in how Streamlit wires up Plotly’s selection events, especially as the number of traces increases. There are similar reports where selection works for up to 3 traces but fails for 4 or more, and this has been discussed in community threads and GitHub issues. As a workaround, you might try updating to the latest Streamlit and Plotly versions, or restructuring your chart (e.g., combining data sources into a single trace with a categorical marker). If you can share a minimum reproducible example, that would help the community dig deeper! Also, feel free to check the FAQ for updates, and let’s see if others have encountered and solved this too.
Sources: