Pie如何根据不同的分类展示不同的外径大小 #3056
Replies: 3 comments
-
|
标题:Pie 图如何根据分类动态设置外径大小 Ant Design Charts 的 Pie(饼图)组件,默认每个分类采用统一的外径(radius),即所有扇区的大小一致。如果你的需求是「不同分类展示不同的外径大小」,类似于变形的环状图或玫瑰图(Nightingale Rose Chart),可通过设置 pieRadius 字段来实现。
1. 推荐方案:使用玫瑰图(Nightingale Rose Chart)通过 核心参数说明
标准代码示例import { Pie } from '@ant-design/charts';
const data = [
{ type: '分类A', value: 10 },
{ type: '分类B', value: 30 },
{ type: '分类C', value: 50 },
];
const config = {
data,
angleField: 'value', // 控制扇区角度
colorField: 'type', // 分类字段
radius: 0.8, // 饼图外径占比
isRose: true, // 开启玫瑰图,外径按照 value 自动调整
label: {
type: 'inner',
offset: '-50%',
content: '{value}',
style: {
fontSize: 14,
textAlign: 'center',
},
},
};
export default () => <Pie {...config} />;**效果:**每个分类的扇区,外径随 value 增大而增长,形成类似你图片的“外扩”效果。 2. 参数含义
3. 相关文档链接4. 其他说明
如需求还有特殊定制,请补充你的具体场景(例如“希望根据某字段动态调整扇区外径”),方便进一步指导。 此回答由AI自动生成,仅供参考。如有疑问,请等待维护者回复。 |
Beta Was this translation helpful? Give feedback.
-
|
希望每个类型的扇区外径是固定的,不随着value值变化怎么处理 |
Beta Was this translation helpful? Give feedback.
-
|
目前外径就是固定的。 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pie如何根据不同的分类展示不同的外径大小

Beta Was this translation helpful? Give feedback.
All reactions