From a0db57bdf2f86a90b3dfaefbe2a0441d6dedffdb Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 20 Mar 2023 21:38:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=8F=98=E6=9B=B4=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Internal/Utilities/ChartHelper.cs | 2 +- Runtime/Serie/SerieData.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Runtime/Internal/Utilities/ChartHelper.cs b/Runtime/Internal/Utilities/ChartHelper.cs index 8578120e..d98ffa12 100644 --- a/Runtime/Internal/Utilities/ChartHelper.cs +++ b/Runtime/Internal/Utilities/ChartHelper.cs @@ -389,7 +389,7 @@ namespace XCharts.Runtime var alignment = textStyle.GetAlignment(autoAlignment); UpdateAnchorAndPivotByTextAlignment(alignment, out anchorMin, out anchorMax, out pivot); var labelObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta); - ChartHelper.RemoveComponent(labelObj); + //ChartHelper.RemoveComponent(labelObj); var label = EnsureComponent(labelObj); label.text = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme, autoColor, autoAlignment, label.text); diff --git a/Runtime/Serie/SerieData.cs b/Runtime/Serie/SerieData.cs index 226ee361..ca1492da 100644 --- a/Runtime/Serie/SerieData.cs +++ b/Runtime/Serie/SerieData.cs @@ -484,7 +484,7 @@ namespace XCharts.Runtime return GetCurrData(index, animationDuration, inverse, 0, 0, unscaledTime); } - public double GetCurrData(int index, float animationDuration, bool inverse, double min, double max, bool unscaledTime) + public double GetCurrData(int index, float animationDuration, bool inverse, double min, double max, bool unscaledTime, bool loop = false) { if (index < m_DataUpdateFlag.Count && m_DataUpdateFlag[index] && animationDuration > 0) { @@ -496,7 +496,13 @@ namespace XCharts.Runtime if (rate < 1) { CheckLastData(unscaledTime); - var curr = MathUtil.Lerp(GetPreviousData(index), GetData(index), rate); + var prev = GetPreviousData(index); + var next = GetData(index); + if (loop) + { + if (next <= min && prev != 0) next = max; + } + var curr = MathUtil.Lerp(prev, next, rate); if (min != 0 || max != 0) { if (inverse)