Merge pull request 'fix:判断图表为0的时候的情况;' (#329) from yangws into main
Reviewed-on: #329
This commit is contained in:
commit
a83cbc2ba2
|
@ -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