Hi, I have a series of select boxes implemented on my web app. The app pulls the data from a database and then gives visualizations and select box filter options based on the default values. When the user choose a option from the first select box, the data will be filtered and the visualizations and options in the select boxes under it changes. This works some times but most of the time when the user selects a options from one of the slectboxes, instead of updating the visualizations based on the chosen option, the app reloads and the visualizations are again reset to the defaults values. Has anyone encountered this issue?
Could you please share a minimal reproducible code snippet which demonstrates this issue?
view_filter=st.selectbox(‘Priortize by:’,(‘op1’,‘op2’),key =69)
fig1, top_n_list = function1(df_t2,view_filter,15)
st.plotly_chart(fig1)
if sideabar_option1 ==‘PGroup’:
if sidebar_option2=='All':
n_filter=st.selectbox('**n**',top_n_list, key = 1000)
df_t2=df_t2[df_t2.n == n_filter]
fig2, top_p_list = function1(df_t2, view_filter,15)
st.plotly_chart(fig2)
if sidebar_option2 != 'All':
n_filter=st.selectbox('**n**',top_n_list,key = 1001)
df_t2=df_t2[df_t2.n == n_filter]
top_p_list = [sidebar_option2]
if sidebar_option2 =='All':
p_filter = st.selectbox('**p**',(top_p_list ),key =70)
fig3, top_e_list = function1(df_t2_2, view_filter,15)
st.plotly_chart(fig3)
if sidebar_option2 != 'All':
top_e_list =[sidebar_option2 ]
e_filter = st.selectbox('**E**',top_e_list ,key =72)
df_t2=df_t2[df_t2.e== e_filter ]
fig4= function2(df_t2, n_filter)
fig4.update_layout(width = 1200, height = 500)
st.plotly_chart(fig4)
Could you repost your example as a code block, using ```'s surrounding it?
Also, this is not a complete and reproducible code snippet, because it won’t work without some values for df_t2, at least – do you have some example data that will work?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.