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)