I can’t figure this out for the life of me. In my main()
function I am initializing two placeholders – plot_placeholder and df_placeholder.
These are there to structure the UI layout before the data is available to fill the space and to automatically hide the chart/dataframe if the underlying data changed and it needs to be refetched.
But the plotly chart and dataframe expanders will not display until you change the value on one of the slider slider widgets in the sidebar.
You can test it out by:
- enter SPY into ticker symbol input and press enter. This loads the expiration dropdowns. They dont need to be changed but can be.
- Select ‘Net Delta’ from Chart Type dropdown.
- Click ‘Get Data’ button
The data will fetch after a few seconds and you might see a chart flash on the screen for a second and then disappear. Change any of the slider values and everything will display.
I think its related to my usage of plot_placeholder and df_placeholder, but I’m not sure how.
I just added a state variable plot_visible
to the session_state and I updated my main()
function to not display the plot_placeholder if [‘plot_visible’] was True.
Now the neither plot_placeholder or the chart is displaying until a widget is updated.
I don’t get it. Thanks for any help!