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 { > +