Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events not bubbling consistently on px.scatter plot #7

Open
esandoval30 opened this issue Sep 14, 2023 · 1 comment
Open

Events not bubbling consistently on px.scatter plot #7

esandoval30 opened this issue Sep 14, 2023 · 1 comment

Comments

@esandoval30
Copy link

streamlit_plotly_events==0.0.6
streamlit==1.23.1
streamlit-autorefresh==1.0.1
plotly==5.15.0
plotly-express==0.4.1

#bubble chart
fig = px.scatter(df_bubble, x="total_amount", y="total_transactions",
size="total_amount",color=category_selected,
hover_name="fraud_probability", log_y=False, log_x=False, size_max = 40, width=600, height=500)

#listen to events
selected_points = plotly_events(fig,click_event=True,hover_event=False)

When I click on a specific bubble in this scatter plot, selected_points contains data approx 10% of the times

What could be happening?

@esandoval30
Copy link
Author

esandoval30 commented Sep 15, 2023

I found that the query behind the dataframe feeding the scatter plot was taking too long.

I added a @st.cache_data(ttl=30) decorator to the method that executes the query.
It all works now.

All clicks are captured in selected_points

Not sure exactly why/how but I hope this helps others workaround or fix this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant