Hello,
I am stuck since some days on the following issue : with new on_select parameter of st.plotly_chart everithing works well if I am using doc sample with px.data.iris, but if I am using my own dataframe selection event does not trigger and I can’t get back selection informations.
An idea?
Thanks.
David
run app locally
python 3.10
streamlit 1.46.0
plotly_express 0.4.1
import streamlit as st
import plotly.express as px
import numpy as np
import pandas as pd
# df = px.data.iris() # iris is a pandas DataFrame
# Generate the large dataset
large_data = {
'sepal_length': np.random.rand(1000),
'col2': np.random.rand(1000)
}
df = pd.DataFrame(large_data)
df_downsampled = df.iloc[::10, :]
st.write(df_downsampled)
fig = px.scatter(df_downsampled, x=df_downsampled.index, y=df_downsampled.sepal_length)
event = st.plotly_chart(fig, key="test", on_select="rerun")
event