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++) { value += validPoints[i].value; } return value.toFixed(0); // 保留一位小数 } else { return ""; } } |