@@ -351,7 +351,7 @@ const legendSet = computed(() => {
351351 ... el,
352352 proportion: el .value / props .dataset .map (m => (m .values || []).reduce ((a , b ) => a + b, 0 )).reduce ((a , b ) => a + b, 0 ),
353353 opacity: segregated .value .includes (i) ? 0.5 : 1 ,
354- segregate : () => segregate (i),
354+ segregate : () => ! isAnimating . value && segregate (i),
355355 isSegregated: segregated .value .includes (i)
356356 }
357357 })
@@ -438,6 +438,10 @@ const average = computed(() => {
438438 return total .value / donutSet .value .length ;
439439});
440440
441+ const legendPercentage = computed (() => {
442+ return legend => isAnimating .value ? legend .proportion * 100 : legend .value / total .value * 100
443+ })
444+
441445const dataTooltipSlot = ref (null );
442446
443447const useCustomFormat = ref (false );
@@ -1193,7 +1197,11 @@ defineExpose({
11931197 @clickMarker =" ({i}) => segregate(i)"
11941198 >
11951199 <template #item =" { legend , index } " >
1196- <div :data-cy =" `legend-item-${index}`" @click =" legend.segregate()" :style =" `opacity:${segregated.includes(index) ? 0.5 : 1}`" >
1200+ <div
1201+ :data-cy =" `legend-item-${index}`"
1202+ :style =" `opacity:${segregated.includes(index) ? 0.5 : 1}`"
1203+ @click =" legend.segregate()"
1204+ >
11971205 {{ legend.name }}: {{ applyDataLabel(
11981206 FINAL_CONFIG.style.chart.layout.labels.value.formatter,
11991207 legend.value,
@@ -1212,9 +1220,9 @@ defineExpose({
12121220 <span v-if =" !segregated.includes(index)" style =" font-variant-numeric : tabular-nums ;" >
12131221 ({{ isNaN(legend.value / total) ? '-' : applyDataLabel(
12141222 FINAL_CONFIG.style.chart.layout.labels.percentage.formatter,
1215- isAnimating ? legend.proportion * 100 : legend.value / total * 100 ,
1223+ legendPercentage( legend) ,
12161224 dataLabel({
1217- v: isAnimating ? legend.proportion * 100 : legend.value / total * 100 ,
1225+ v: legendPercentage( legend) ,
12181226 s: '%',
12191227 r: FINAL_CONFIG.style.chart.legend.roundingPercentage
12201228 }))
0 commit comments