Pie Charts if all the data are 0, should show blank, not evenly divided the pie.
问题简述 (One-line summary)
If there are for example 4 data elements and the values are all 0, it should show a blank pie, not a pie evenly divided by 4.
版本及环境 (Version & Environment)
- ECharts 版本 (ECharts version): v3.1.10
- 浏览器类型和版本 (Browser version): any browser
- 操作系统类型和版本 (OS Version): windows7
current pie chart:
重现步骤 (Steps to reproduce)
1.use the option provided to draw the piechart
期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)
When sum is 0, assume all the parts are 2pi/N. In fact, 0 means occupy nothing no matter sum is 0 or not. The user should see nothing except the circle boundary to show no data at all.
ECharts配置项 (ECharts option)
option = {
series: [
{
type: "pie",
radius: "65%",
itemStyle: {
normal: {
borderColor: '#fff',
borderWidth: '0'
},
emphasis: {
borderColor: '#fff',
borderWidth: '0'
}
},
label: {
normal: {
show: false
}
},
center: ["50%", "43%"],
data: [
{
"name": "21-40%",
"value": "0"
},
{
"name": "41-60%",
"value": "0"
},
{
"name": "61-80%",
"value": "0"
},
{
"name": "81-100%",
"value": "0"
}
]
}
],
color: [
"#FF8C00",
"#FFD700",
"#6B8E23",
"#3D3D3D"
],
title: {
show: true,
text: "Sample",
left: "center",
top: "top"
},
legend: {
data: [
"21-40%",
"41-60%",
"61-80%",
"81-100%"
],
left: 'center',
bottom: '10',
borderWidth: 1,
borderColor: '#FAAC58',
},
tooltip: {
show: true,
showContent: true,
trigger: 'item',
formatter: '{b}:<br />{c}',
}
}
其他信息 (Other comments)
I am also facing the same issue. please fix it in the next release
same problem here..
This issue is closed due to not being active. Please feel free to open it again (for the author) or create a new one and reference this (for others) if you have further questions.
Any updates?
Any update on this . looking for the same solution
stillShowZeroSum = true
Try transform the data to [null, 0] instead of [0, 0]
+1
+1
Waiting for this feature
https://stackoverflow.com/a/78188257/15167500
When checking the numerical values upon data transmission, if it verifies and transmits null instead of 0 values, the chart interprets null as empty and will not display the respective set.
const values = [0, 0, 0, 0, 1];
const names = ['A', 'B', 'C', 'D', 'E'];
const data = values.map((v, i) => ({ name: names[i], value: v === 0 ? null : v }));
/* Result:
[
{ name: 'A', value: null },
{ name: 'B', value: null },
{ name: 'C', value: null },
{ name: 'D', value: null },
{ name: 'E', value: 1 }
]
*/
If all values are 0, then I believe it logically distributes the segments evenly in the circle, as they all represent equally zero value. Therefore, their ratio remains the same. I would rather introduce an option to interpret 0 as null in the diagram or not. Until such an option exists, this can be done manually as well.