diff --git a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue index 77c3522..5447495 100644 --- a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue +++ b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue @@ -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',