echarts
echarts copied to clipboard
[Feature] 饼图配置了padAngle时,如果数据为0,希望padAngle为0
What problem does this feature solve?
饼图配置了padAngle时,如果数据项有多个,但是只有1个数据有值,其它全部为0时,为0的数据项的padAngle会累积在一起,看起来有一块空的,就像下面这个例子一样(例子加了border,为了方便看效果) https://codesandbox.io/p/sandbox/lytnth
What does the proposed API look like?
希望:
- 如果数据项值为0时,无论是否配置了padAngle,都把该项的pagAngle设置为0;
- 如果只有一个数据有值(大于0),则把所有项的padAngle处理为0;
- 如果有多个数据项,只有一个数据有值(大于0),则把所有项的padAngle处理为0;
也可以增加配置项,业务自己控制单个数据项的padAngle,例如为data添加padAngle配置:
option = {
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
name: 'Access From',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
padAngle: 5,
minAngle: 0,
itemStyle: {
borderRadius: 0,
borderWidth: 5,
borderColor: 'red',
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: 40,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 0, name: 'Union Ads', padAngle: 0, },
{ value: 0, name: 'Union Ads', padAngle: 0, },
{ value: 1, name: 'Video Ads' }
]
}
]
};