diff --git a/plugins/plugin-chart-echarts/src/Pie/transformProps.ts b/plugins/plugin-chart-echarts/src/Pie/transformProps.ts index eb4da7b335..9b3ca9de70 100644 --- a/plugins/plugin-chart-echarts/src/Pie/transformProps.ts +++ b/plugins/plugin-chart-echarts/src/Pie/transformProps.ts @@ -102,6 +102,7 @@ export default function transformProps(chartProps: EchartsPieChartProps): PieCha emitFilter, }: EchartsPieFormData = { ...DEFAULT_LEGEND_FORM_DATA, ...DEFAULT_PIE_FORM_DATA, ...formData }; const metricLabel = getMetricLabel(metric); + const minShowLabelAngle = (showLabelsThreshold || 0) * 3.6; const keys = data.map(datum => extractGroupbyLabel({ @@ -157,15 +158,12 @@ export default function transformProps(chartProps: EchartsPieChartProps): PieCha {}, ); - const formatter = (params: CallbackDataParams) => { - if (params.percent && params.percent < showLabelsThreshold) return ''; - - return formatPieLabel({ + const formatter = (params: CallbackDataParams) => + formatPieLabel({ params, numberFormatter, labelType, }); - }; const defaultLabel = { formatter, @@ -182,6 +180,7 @@ export default function transformProps(chartProps: EchartsPieChartProps): PieCha center: ['50%', '50%'], avoidLabelOverlap: true, labelLine: labelsOutside && labelLine ? { show: true } : { show: false }, + minShowLabelAngle, label: labelsOutside ? { ...defaultLabel,