How to fetch data from a pie chart after clicking on a slice? I am using plotly express and streamlit plotly events

Hi,

I am trying to create an interactive filtering from a pie chart.
My requirement is that whenever I click on a slice it should return name and value parameter.
I am using streamlit_plotly_events library to achieve this but no luck.
The plotly_event(fig) only returns [{‘curveNumber’: 0, ‘pointNumber’: 1}]

Providing code and screenshot:

import plotly.express as px
from streamlit_plotly_events import plotly_events
df_closetype = df_all_cust.ACCOUNT_CLOSED_TYPE.value_counts().nlargest(5).reset_index()
df_closetype[‘Percentage’] = ((df_closetype[‘count’] / df_closetype[‘count’].sum()) * 100).round(2)
fig = px.pie(
df_closetype,
width = 400,
height = 400,
names=‘ACCOUNT_CLOSED_TYPE’,
values=‘count’,
title=‘Top 5 Account Closed Types’,
hover_data={‘Percentage’: ‘:.2f%’},
)

            #st.plotly_chart(fig)
            clicked_data = plotly_events(fig) 
            st.write(clicked_data)