From 9d8b95ddc4b9ae0939ef2ea8e404a19c9c4b8fcd Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Tue, 31 Aug 2021 21:05:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96`RingChart`=E7=9A=84=E6=B8=90?= =?UTF-8?q?=E5=8F=98=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG-EN.md | 1 + CHANGELOG.md | 1 + Runtime/Internal/DrawSerieRing.cs | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG-EN.md b/CHANGELOG-EN.md index 7c9e26ce..57fc1aa4 100644 --- a/CHANGELOG-EN.md +++ b/CHANGELOG-EN.md @@ -39,6 +39,7 @@ ## master +* (2021.08.31) Optimized the gradient effect of `RingChart` * (2021.08.31) Fixed bug where `SerieLabel` does not refresh when `DataZoom` is dragged (#165) * (2021.08.25) Fixed an issue where the theme switch could not be save to the scene (#166) * (2021.08.24) Added `Animation`'s `alongWithLinePath` diff --git a/CHANGELOG.md b/CHANGELOG.md index 2455fc29..c9e8b4b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ ## master +* (2021.08.31) 优化`RingChart`的渐变效果 * (2021.08.31) 修复`DataZoom`拖动时`SerieLabel`不刷新的问题 (#165) * (2021.08.25) 修复`Theme`主题切换无法保持到场景上的问题 (#166) * (2021.08.24) 增加`Animation`的`alongWithLinePath`参数设置折线轨迹匀速动画 diff --git a/Runtime/Internal/DrawSerieRing.cs b/Runtime/Internal/DrawSerieRing.cs index 6c01e9c8..8cdb4117 100644 --- a/Runtime/Internal/DrawSerieRing.cs +++ b/Runtime/Internal/DrawSerieRing.cs @@ -104,6 +104,14 @@ namespace XCharts itemStyle.backgroundColor, Color.clear, 0, 360, borderWidth, borderColor, 0, chart.settings.cicleSmoothness, false, serie.clockwise); } + var isGradient = !UGLHelper.IsValueEqualsColor(itemColor, itemToColor); + if (isGradient) + { + if (serie.clockwise) + itemToColor = Color.Lerp(itemColor, itemToColor, toDegree / (startDegree + 360)); + else + itemToColor = Color.Lerp(itemToColor, itemColor, toDegree / (startDegree + 360)); + } UGL.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius, outsideRadius, itemColor, itemToColor, Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness, roundCap, serie.clockwise);