From d432b671a9ffb48ffc834d89d96b6218f1f65328 Mon Sep 17 00:00:00 2001 From: likexuan Date: Mon, 1 Aug 2022 17:54:55 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E9=A5=BC=E5=9B=BED3=20=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chart/chartPieD3.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nezha-fronted/src/components/chart/chart/chartPieD3.vue b/nezha-fronted/src/components/chart/chart/chartPieD3.vue index 60de96d9c..af590cdd1 100644 --- a/nezha-fronted/src/components/chart/chart/chartPieD3.vue +++ b/nezha-fronted/src/components/chart/chart/chartPieD3.vue @@ -230,6 +230,9 @@ export default { if (Math.ceil(this.outerRadius / 8) < 30) { height = Math.ceil(this.outerRadius / 8) * 3 } + if ((d.endAngle - d.startAngle) > 5) { + height += this.outerRadius + } return y - height / 2 }) .attr('x', d => { // y轴居中减文字大小的一半 @@ -240,9 +243,9 @@ export default { width = 0 } else { if ((d.endAngle - d.startAngle) > 5) { - width = this.outerRadius + width = this.outerRadius * 2 } - width = this.outerRadius * (d.endAngle - d.startAngle) / 5 + width = this.outerRadius * (d.endAngle - d.startAngle) / 3.14 width = width > this.outerRadius / 3 ? width : this.outerRadius / 3 } return x - width / 2 @@ -258,13 +261,13 @@ export default { if ((d.endAngle - d.startAngle) < 0.25) { return 0 } else { - if ((d.endAngle - d.startAngle) > 3.14) { - return this.outerRadius + if ((d.endAngle - d.startAngle) > 5) { + return this.outerRadius * 2 } let width = 0 showAngle += d.endAngle - d.startAngle - if (showAngle > 0.5) { - width = this.outerRadius * (d.endAngle - d.startAngle) / 5 + if (showAngle > 0.75) { + width = this.outerRadius * (d.endAngle - d.startAngle) / 3.14 width = width > this.outerRadius / 3 ? width : this.outerRadius / 3 showAngle = 0 } else { @@ -467,5 +470,5 @@ export default { > +