From bacec6dec257392275404666c2549739dae4a5bd Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Fri, 29 May 2020 08:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`PieChart`=E8=AE=BE=E7=BD=AE`?= =?UTF-8?q?space`=E6=97=B6=E5=8F=AA=E6=9C=89=E4=B8=80=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E7=BB=98=E5=88=B6=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/CHANGELOG.md | 1 + Assets/XCharts/Runtime/Utility/ChartDrawer.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index f892f80d..a69a4c94 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.05.29) 修复`PieChart`设置`space`时只有一个数据时绘制异常的问题 * (2020.05.27) 修复调用`UpdateDataName()`接口时不会自动刷新的问题 * (2020.05.27) 优化`柱状图`的渐变色效果 * (2020.05.24) 修复`Axis`同时设置`boundaryGap`和`alignWithLabel`时`Tick`绘制异常的问题 diff --git a/Assets/XCharts/Runtime/Utility/ChartDrawer.cs b/Assets/XCharts/Runtime/Utility/ChartDrawer.cs index b4ef8036..95cad661 100644 --- a/Assets/XCharts/Runtime/Utility/ChartDrawer.cs +++ b/Assets/XCharts/Runtime/Utility/ChartDrawer.cs @@ -811,6 +811,7 @@ namespace XCharts float smoothness, int gradientType = 0, bool isYAxis = false) { if (radius == 0) return; + if (space > 0 && Mathf.Abs(toDegree - startDegree) >= 360) space = 0; radius -= borderWidth; smoothness = (smoothness < 0 ? 2f : smoothness); int segments = (int)((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness); @@ -998,6 +999,7 @@ namespace XCharts Color32 borderColor, float space, float smoothness, bool roundCap = false, bool clockwise = true) { if (toDegree - startDegree == 0) return; + if (space > 0 && Mathf.Abs(toDegree - startDegree) >= 360) space = 0; if (insideRadius <= 0) { DrawSector(vh, p, outsideRadius, color, toColor, startDegree, toDegree, borderWidth, borderColor,