From a69667337d33def2f455c59fd74a0ac0cac64b46 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Tue, 22 Sep 2020 07:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`PieChart`=E8=BE=B9=E6=A1=86?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/CHANGELOG-EN.md | 1 + Assets/XCharts/CHANGELOG.md | 1 + Assets/XCharts/Runtime/Internal/Utility/ChartDrawer.cs | 7 +++---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/XCharts/CHANGELOG-EN.md b/Assets/XCharts/CHANGELOG-EN.md index 3143d7be..055bdc75 100644 --- a/Assets/XCharts/CHANGELOG-EN.md +++ b/Assets/XCharts/CHANGELOG-EN.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.09.22) Fixed `PieChart` inconsistent border size * (2020.09.18) Added `Remove All Chart Object` to Remove All child nodes under the Chart (automatically reinitialized) * (2020.09.18) Fixed `SerieLabel` also displayed after hided `Serie` by clicked the legend #94 * (2020.09.18) Optimize coordinate axis calibration and text display #93 diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index 86036ff7..3bc182bd 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.09.22) 修复`PieChart`边框大小不一致的问题 * (2020.09.19) 发布`v1.6.1`版本 * (2020.09.19) 增加`Remove All Chart Object`移除图表下的所有子节点(会自动重新初始化) * (2020.09.18) 修复`SerieLabel`在点击图例隐藏`Serie`后还显示的问题#94 diff --git a/Assets/XCharts/Runtime/Internal/Utility/ChartDrawer.cs b/Assets/XCharts/Runtime/Internal/Utility/ChartDrawer.cs index 4a669de3..936f0cb7 100644 --- a/Assets/XCharts/Runtime/Internal/Utility/ChartDrawer.cs +++ b/Assets/XCharts/Runtime/Internal/Utility/ChartDrawer.cs @@ -865,6 +865,7 @@ namespace XCharts var lastColor = color; var needBorder = borderWidth != 0; var needSpace = space != 0; + var borderLineWidth = needSpace ? borderWidth : borderWidth / 2; var lastPos = Vector3.zero; var middleDire = ChartHelper.GetDire(startAngle + halfAngle); if (needBorder || needSpace) @@ -884,9 +885,9 @@ namespace XCharts } if (needBorder) { - borderDiff = borderWidth / Mathf.Sin(halfAngle); + borderDiff = borderLineWidth / Mathf.Sin(halfAngle); realCenter += borderDiff * middleDire; - borderAngle = 2 * Mathf.Asin(borderWidth / (2 * radius)); + borderAngle = 2 * Mathf.Asin(borderLineWidth / (2 * radius)); realStartAngle = realStartAngle + borderAngle; realToAngle = realToAngle - borderAngle; if (realToAngle < realStartAngle) @@ -963,8 +964,6 @@ namespace XCharts } } - - public static void DrawRoundCap(VertexHelper vh, Vector3 center, float width, float radius, float angle, bool clockwise, Color32 color, bool end) {