[feature] Add smoothLimit for Line

This commit is contained in:
monitor1394
2022-10-10 07:07:57 +08:00
parent 5ed6ee1d2a
commit 0662f62cd1
4 changed files with 17 additions and 1 deletions

View File

@@ -505,7 +505,7 @@ namespace XCharts.Runtime
if (isY)
UGLHelper.GetBezierListVertical(ref s_CurvesPosList, sp, ep, smoothness, setting.lineSmoothStyle);
else
UGLHelper.GetBezierList(ref s_CurvesPosList, sp, ep, lsp, nep, smoothness, setting.lineSmoothStyle, true);
UGLHelper.GetBezierList(ref s_CurvesPosList, sp, ep, lsp, nep, smoothness, setting.lineSmoothStyle, serie.smoothLimit);
for (int j = 1; j < s_CurvesPosList.Count; j++)
{
serie.context.drawPoints.Add(new PointInfo(s_CurvesPosList[j], ignore));

View File

@@ -247,6 +247,7 @@ namespace XCharts.Runtime
[SerializeField] private float m_SampleAverage = 0;
[SerializeField] private LineType m_LineType = LineType.Normal;
[SerializeField][Since("v3.3.1")] private bool m_SmoothLimit = true;
[SerializeField] private BarType m_BarType = BarType.Normal;
[SerializeField] private bool m_BarPercentStack = false;
[SerializeField] private float m_BarWidth = 0;
@@ -492,6 +493,16 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_LineType, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to restrict the curve. When true, the curve between two continuous data of the same value
/// is restricted to not exceed the data point, and is flat to the data point.
/// |是否限制曲线。当为true时两个连续相同数值的数据间的曲线会限制为不超出数据点和数据点是平直的。
/// </summary>
public bool smoothLimit
{
get { return m_SmoothLimit; }
set { if (PropertyUtil.SetStruct(ref m_SmoothLimit, value)) { SetVerticesDirty(); } }
}
/// <summary>
/// the min pixel dist of sample.
/// |采样的最小像素距离默认为0时不采样。当两个数据点间的水平距离小于改值时开启采样保证两点间的水平距离不小于改值。
/// </summary>