function sumLabel() {
const point = this;
const points = point.points;
const validPoints = points.filter((point) => point.isVisible());
if (point === validPoints[validPoints.length - 1]) {
let value = 0;
for (let i = 0; i < validPoints.length; i++) {
// 使用 toFixed 规避浮点累加误差
value = Number((value + validPoints[i].value).toFixed(10));
}
// 返回保留两位小数的值
return Number(value.toFixed(2));
} else {
return "";
}
}