Line支持Clip

This commit is contained in:
monitor1394
2023-05-20 08:52:02 +08:00
parent bab788d4cb
commit 4c1432a535
3 changed files with 14 additions and 39 deletions

View File

@@ -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<Vector3>();
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)

View File

@@ -839,7 +839,8 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_Large, value)) SetAllDirty(); }
}
/// <summary>
/// 开启大数量优化的阈值。只有当开启了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并且数据量大于该阀值时才进入性能模式。
/// </summary>
public int largeThreshold
{
@@ -847,7 +848,8 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_LargeThreshold, value)) SetAllDirty(); }
}
/// <summary>
/// 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
/// 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.
/// |在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
/// </summary>
public bool avoidLabelOverlap
{

View File

@@ -339,8 +339,8 @@ namespace XUGL
if (Vector3.Cross(dir1, dir2) == Vector3.zero && np != cp)
{
itp = ntp;
ibp = nbp;
itp = clp;
ibp = crp;
return;
}