Plotly selections dont return selected values

I am using python version 3.12 and streamlit version 1.35. I am trying to select data from a plotly chart which contains normal x and y values. The values are loaded from a csv file. I am also using caching to reduce runtime.

When I click a point on the plotly chart , i am not getting a dictionary of selections , instead the whole page reruns and the dictionary Displayed is empty. I am wondering what could be the issue. When i do this on a different app , it works.

Is there a limit on the number of points on the plot under which selections can work or maybe its a different issue?

Thanks in advance

What do you mean by different app?

A different app means a different streamlit app. A simple app where the x and y values are list of 10 random numbers.

Apart from the size of the lists , the two apps dont differ much in logic and execution.

Constrain your conditions. Do it step by step. Don’t rely 100% on your logic. Anything can happen in programming.

Take data1, use it in app1. Is there an issue? Try the same data on app2. Is there an issue? Then move forward with data2, test with app1 and app2, etc.

Hi there, I seem to have figured out something. So, when I use numpy.random.choice in any part of the code which renders the plots, the selections don’t work. I have removed the random choice and now it works

Not sure if this is an issue with streamlit or is just my code.

Thanks for the suggestion to go step by step! Appreciate!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.