fix:判断图表为0的时候的情况;
This commit is contained in:
parent
09575b9896
commit
a521010392
|
@ -74,7 +74,7 @@ function initChart() {
|
|||
position: 'top',
|
||||
formatter: params => {
|
||||
const value = dataList.value[params.dataIndex].value;
|
||||
const percentage = ((value / total) * 100).toFixed(); // 计算百分比并保留两位小数
|
||||
const percentage = value ? ((value / total) * 100).toFixed() : 0; // 计算百分比并保留两位小数
|
||||
return `${value}人 ${percentage}%`; // 显示为百分比形式
|
||||
},
|
||||
color: '#333',
|
||||
|
|
Loading…
Reference in New Issue