Skip to content

[Bug]: [Pie] Outer labels overlap and become unreadable when one slice dominates with many small slices (v2 regression) #3155

@RuchitPatel14

Description

@RuchitPatel14

Describe the bug / 问题描述

Version: @ant-design/plots 2.6.8 (migrated from 1.2.6)

Environment: React 18

Description:
After upgrading from v1 (1.2.6) to v2 (2.6.8), the Pie chart's outer label layout breaks when there is one dominant slice and many small slices. Labels for the small slices stack on top of each other, overlap, and become completely unreadable. This worked correctly in v1.

Reproduction:

import { Pie } from '@ant-design/plots';
import React from 'react';
import { createRoot } from 'react-dom/client';

const DemoPie = () => {
    const data = Array.from({ length: 50 }, (_, i) => ({
  type: `test ${i + 1}`,
  value: i === 1 ? 11000 : i + 1,
}))
  const config = {
    padding: 80,
    data: data,
    angleField: 'value',
    colorField: 'type',
    label: {
      text: 'value',
      position: 'outside',
      transform: [{ type: 'overlapHide' }]
    },
    legend: {
      color: {
        title: false,
        position: 'right',
        rowPadding: 5,
      },
    },
  };
  return <Pie {...config} />;
};

createRoot(document.getElementById('container')).render(<DemoPie />);

Expected behavior:
Labels should either auto-adjust spacing to avoid overlap, hide when space is insufficient, or provide a readable layout — as they did in v1.

Actual behavior:
All 50 outer labels render on top of each other around the small-slice side of the pie, making them completely illegible (see screenshot).

I already checked and tried all transforms and diff position https://ant-design-charts.antgroup.com/options/plots/label#transform

Screenshot:

Image

v1 screenshot

Image

Reproduction link / 复现链接

https://codesandbox.io/p/sandbox/9p88s4

Please try the above code snippet

Steps to Reproduce the Bug or Issue / 重现步骤

v1 https://ant-design-charts-v1.antgroup.com/en/examples/pie/basic/#outer-label
v2 https://ant-design-charts.antgroup.com/en/examples/statistics/pie/#outer-label

Version / 版本

2.6.8

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't workingplots统计图表G2

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions