From 4c1432a53533accf94e1158a003a194bbee22593 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sat, 20 May 2023 08:52:02 +0800 Subject: [PATCH] =?UTF-8?q?Line=E6=94=AF=E6=8C=81Clip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Serie/Line/LineHelper.cs | 43 ++++++-------------------------- Runtime/Serie/Serie.cs | 6 +++-- Runtime/XUGL/UGLHelper.cs | 4 +-- 3 files changed, 14 insertions(+), 39 deletions(-) diff --git a/Runtime/Serie/Line/LineHelper.cs b/Runtime/Serie/Line/LineHelper.cs index 2d796b41..4e99f640 100644 --- a/Runtime/Serie/Line/LineHelper.cs +++ b/Runtime/Serie/Line/LineHelper.cs @@ -286,8 +286,7 @@ namespace XCharts.Runtime var lastDataIsIgnore = datas[0].isIgnoreBreak; var smooth = serie.lineType == LineType.Smooth; - var firstInGridPointIndex = smooth && serie.clip ? -1 : 1; - // var interactPoints = new List(); + var firstInGridPointIndex = serie.clip ? -1 : 1; for (int i = 1; i < dataCount; i++) { var cdata = datas[i]; @@ -310,38 +309,10 @@ namespace XCharts.Runtime var isClip = false; if (serie.clip) { - //if (smooth) - { - if (!grid.Contains(cp)) - isClip = true; - else if (firstInGridPointIndex <= 0) - firstInGridPointIndex = i; - if (firstInGridPointIndex > 0 && !grid.Contains(np)) - isClip = true; - } - // else - // { - // var isLpInGrid = grid.Contains(lp); - // var isCpInGrid = grid.Contains(cp); - // if (!isLpInGrid || !isCpInGrid) - // { - // interactPoints.Clear(); - // if (grid.BoundaryPoint(lp, cp, ref interactPoints)) - // { - // if (interactPoints.Count >= 2) - // { - // lp = interactPoints[0]; - // cp = interactPoints[1]; - // } - // else if (isLpInGrid) - // cp = interactPoints[0]; - // else - // lp = interactPoints[0]; - // if (i == dataCount - 1) - // np = cp; - // } - // } - // } + if (!grid.Contains(cp)) + isClip = true; + else if (firstInGridPointIndex <= 0) + firstInGridPointIndex = i; if (isClip) isIgnore = true; } if (!smooth) @@ -384,8 +355,10 @@ namespace XCharts.Runtime ref itp, ref ibp, ref clp, ref crp, ref bitp, ref bibp, i); - if (i == firstInGridPointIndex) + + if (i == 1) { + if (isClip) lastDataIsIgnore = true; AddLineVertToVertexHelper(vh, ltp, lbp, lineColor, isVisualMapGradient, isLineStyleGradient, visualMap, serie.lineStyle, grid, axis, relativedAxis, false, lastDataIsIgnore, isIgnore); if (dataCount == 2 || isBreak) diff --git a/Runtime/Serie/Serie.cs b/Runtime/Serie/Serie.cs index 2f5e9ec4..986f82bc 100644 --- a/Runtime/Serie/Serie.cs +++ b/Runtime/Serie/Serie.cs @@ -839,7 +839,8 @@ namespace XCharts.Runtime set { if (PropertyUtil.SetStruct(ref m_Large, value)) SetAllDirty(); } } /// - /// 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。 + /// Turn on the threshold for mass optimization. Enter performance mode only when large is enabled and the amount of data is greater than the threshold. + /// |开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。 /// public int largeThreshold { @@ -847,7 +848,8 @@ namespace XCharts.Runtime set { if (PropertyUtil.SetStruct(ref m_LargeThreshold, value)) SetAllDirty(); } } /// - /// 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。 + /// If the pie chart and labels are displayed externally, whether to enable the label overlap prevention policy is disabled by default. If labels are crowded and overlapped, the positions of labels are moved to prevent label overlap. + /// |在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。 /// public bool avoidLabelOverlap { diff --git a/Runtime/XUGL/UGLHelper.cs b/Runtime/XUGL/UGLHelper.cs index 0ec9158d..c695cb45 100644 --- a/Runtime/XUGL/UGLHelper.cs +++ b/Runtime/XUGL/UGLHelper.cs @@ -339,8 +339,8 @@ namespace XUGL if (Vector3.Cross(dir1, dir2) == Vector3.zero && np != cp) { - itp = ntp; - ibp = nbp; + itp = clp; + ibp = crp; return; }