Hi, I need to attach label + percentage to the legends, in order to do so calculating them and attaching it to labels. something like
data={[
{
values: widgetValues,
labels: function_to_getlabels(),
type: 'pie',
hole: 0.6,
marker: {
colors: widgetColors,
},
name: '',
hovertemplate: '%{label}<br>%{value}',
textinfo: 'none',
},
]}
On click of a legend the labels needs to be recomputed with updated percentages. In order to do so, I am facing a issue in identifying the legend which is clicked in pie chart.
Checked with plotly_legendclick and plotly_relayout.
In plotly_legendclick, the curveNumber always point to 0, no matter what legend is clicked.
In plotly_relayout, I am getting the info of hidden labels, but the default behavoiur of the plotly_legendclick is no longer working.
Is there a better way to generate legends with percentages or how do I update labels when the user clicks on a legend?