mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 06:20:15 +00:00
优化Line3D绘制
This commit is contained in:
@@ -401,7 +401,7 @@ the animation of serie. support animation type: fadeIn, fadeOut, change, additio
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)|
|
||||
|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)|
|
||||
|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)|
|
||||
|
||||
|
||||
@@ -401,7 +401,7 @@ slug: /api
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)|
|
||||
|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)|
|
||||
|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)|
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Runtime
|
||||
animationType = attribute.type;
|
||||
enableSerieDataAnimation = attribute.enableSerieDataAddedAnimation;
|
||||
}
|
||||
UpdateAnimationType(serie.animation, animationType,enableSerieDataAnimation);
|
||||
UpdateAnimationType(serie.animation, animationType, enableSerieDataAnimation);
|
||||
}
|
||||
|
||||
public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)
|
||||
@@ -48,12 +48,12 @@ namespace XCharts.Runtime
|
||||
animation.context.enableSerieDataAddedAnimation = enableSerieDataAnimation;
|
||||
}
|
||||
|
||||
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)
|
||||
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)
|
||||
{
|
||||
if (animation.context.type == AnimationType.AlongPath)
|
||||
{
|
||||
var dist = Vector3.Distance(lp, cp);
|
||||
var rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
|
||||
rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
|
||||
ip = Vector3.Lerp(lp, cp, rate);
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,15 @@ namespace XCharts.Runtime
|
||||
var startPos = isY ? new Vector3(-10000, progress) : new Vector3(progress, -10000);
|
||||
var endPos = isY ? new Vector3(10000, progress) : new Vector3(progress, 10000);
|
||||
|
||||
return UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip);
|
||||
if (UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip))
|
||||
{
|
||||
rate = Vector3.Distance(lp, ip) / Vector3.Distance(lp, cp);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,11 +302,12 @@ namespace XCharts.Runtime
|
||||
isBreak = true;
|
||||
var ip = Vector3.zero;
|
||||
var progress = serie.animation.GetCurrDetail();
|
||||
if (AnimationStyleHelper.GetAnimationPosition(serie.animation, isY, lp, cp, progress, ref ip))
|
||||
var rate = 0f;
|
||||
if (AnimationStyleHelper.GetAnimationPosition(serie.animation, isY, lp, cp, progress, ref ip, ref rate))
|
||||
cp = np = ip;
|
||||
}
|
||||
serie.context.lineEndPostion = cp;
|
||||
serie.context.lineEndValue = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
serie.context.lineEndValueY = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
var handled = false;
|
||||
var isClip = false;
|
||||
if (serie.clip)
|
||||
@@ -382,7 +383,7 @@ namespace XCharts.Runtime
|
||||
AddLineVertToVertexHelper(vh, clp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
serie.context.lineEndPostion = cp;
|
||||
serie.context.lineEndValue = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
serie.context.lineEndValueY = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ namespace XCharts.Runtime
|
||||
/// 线段终点
|
||||
/// </summary>
|
||||
public Vector3 lineEndPostion;
|
||||
public double lineEndValue;
|
||||
public double lineEndValueX;
|
||||
public double lineEndValueY;
|
||||
public double lineEndValueZ;
|
||||
/// <summary>
|
||||
/// 内半径
|
||||
/// </summary>
|
||||
|
||||
@@ -557,7 +557,7 @@ namespace XCharts.Runtime
|
||||
m_EndLabel.SetActive(active);
|
||||
if (active)
|
||||
{
|
||||
var value = serie.context.lineEndValue;
|
||||
var value = serie.context.lineEndValueY;
|
||||
var content = SerieLabelHelper.GetFormatterContent(serie, null, value, 0,
|
||||
endLabelStyle, Color.clear);
|
||||
m_EndLabel.SetText(content);
|
||||
|
||||
Reference in New Issue
Block a user