This is my first post so first of all thanks to the community and everyone helping and contributing!
After searching through the forum and the internet I did not seem to find the answer to my problem:
I am using plotly_events to plot a chart on which I activate a click_event function to get and save data of the point clicked on the graph.
Now the problem is that my app has a sidebar and when creating the chart I can’t format the figure so that it fits in the screen. When the sidebar is open the chart’s right side is out of the screen, but when the sidebar is closed the whole chart is within the screen.
The chart is plotted with: plotly_events(chart, click_event=True)
On the other hand when the chart is created with st.plotly_chart() it fits perfectly with in the app screen.
I have tried passing st.plotly_chart() to plotly_events( st.plotly_chart(), click_event=True).
which solves the displaying problem but then the click_event is not working.
The app includes an interactive chart that the user can change.
Following is the code where the chart is not fitted to the app screen unless I force it using predefined width and height.
Hi @nirco13 , sorry for the late reply. what would be the df and go be? Are those packages? Is it possible to copy and paste that is easily reproducible for me? Otherwise I would have to search for all the packages and guess on some of the code.
Usually df stand for a pandas dataframe and go for plotly graphic objects.
Instead of the df you can use simple arrays like np.array([1,2,3]).
The goal here is to understand how to use the streamlit keyword use_container_width within the community component plotly_events .
Has there been any solution to this problem? I have been experiencing the same issue. The app that I am building contains a charts created from both plotly_events() and st.plotly_chart(). If I change the zoom of my page, the plotly_chart() graph will adapt its size however the the one using st.plotly_chart() will not. The screenshot below shows this (the top graph has been cut off).
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.