增加LabelLinelineEndX可设置引导线固定X位置的支持

This commit is contained in:
monitor1394
2023-08-04 08:39:05 +08:00
parent ea819bfa42
commit 9d3d8543a5
8 changed files with 26 additions and 3 deletions

View File

@@ -1047,6 +1047,8 @@ the data of serie event.
|public method|since|description|
|--|--|--|
|AfterUpdate()||public virtual void AfterUpdate() { }|
|BeforeUpdate()||public virtual void BeforeUpdate() { }|
|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }|
|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }|
|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }|
@@ -1082,6 +1084,8 @@ the data of serie event.
|public method|since|description|
|--|--|--|
|AfterUpdate()||public override void AfterUpdate()|
|BeforeUpdate()||public override void BeforeUpdate()|
|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)|
|ForceUpdateSerieContext()||public override void ForceUpdateSerieContext()|
|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()|

View File

@@ -1165,6 +1165,7 @@ The interface for serie data component.
|lineGap|1.0f||the gap of container and guild line.
|lineLength1|25f||The length of the first segment of visual guide line.
|lineLength2|15f||The length of the second segment of visual guide line.
|lineEndX|0f|v3.8.0|The fixed x position of the end point of visual guide line.
|startSymbol|||The symbol of the start point of labelline. [SymbolStyle](#symbolstyle)|
|endSymbol|||The symbol of the end point of labelline. [SymbolStyle](#symbolstyle)|

View File

@@ -1047,6 +1047,8 @@ serie事件的数据。
|public method|since|description|
|--|--|--|
|AfterUpdate()||public virtual void AfterUpdate() { }|
|BeforeUpdate()||public virtual void BeforeUpdate() { }|
|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }|
|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }|
|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }|
@@ -1082,6 +1084,8 @@ serie事件的数据。
|public method|since|description|
|--|--|--|
|AfterUpdate()||public override void AfterUpdate()|
|BeforeUpdate()||public override void BeforeUpdate()|
|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)|
|ForceUpdateSerieContext()||public override void ForceUpdateSerieContext()|
|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()|

View File

@@ -76,6 +76,8 @@ slug: /changelog
日志详情:
* (2023.08.04) 增加`LabelLine``lineEndX`可设置引导线固定X位置的支持
* (2023.08.04) 增加`Ring``avoidLabelOverlap`避免文本堆叠的支持 (#247)
* (2023.08.03) 完善`Chart``onSerieEnter``onSerieExit``onSerieClick`回调
* (2023.08.02) 修复`BarChart``onSerieEnter``onSerieExit`回调无效的问题
* (2023.08.02) 增加`Symbol``Plus`加号和`Minus`减号的支持

View File

@@ -1165,6 +1165,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|lineGap|1.0f||视觉引导线和容器的间距。
|lineLength1|25f||视觉引导线第一段的长度。
|lineLength2|15f||视觉引导线第二段的长度。
|lineEndX|0f|v3.8.0|视觉引导线结束点的固定x位置。当不为0时会代替lineLength2设定引导线的x位置。
|startSymbol|||起始点的图形标记。 [SymbolStyle](#symbolstyle)|
|endSymbol|||结束点的图形标记。 [SymbolStyle](#symbolstyle)|

View File

@@ -21,6 +21,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_LineGap");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
PropertyField(prop, "m_LineEndX");
PropertyField(prop, "m_StartSymbol");
PropertyField(prop, "m_EndSymbol");
--EditorGUI.indentLevel;

View File

@@ -36,6 +36,7 @@ namespace XCharts.Runtime
[SerializeField] private float m_LineGap = 1.0f;
[SerializeField] private float m_LineLength1 = 25f;
[SerializeField] private float m_LineLength2 = 15f;
[SerializeField][Since("v3.8.0")] private float m_LineEndX = 0f;
[SerializeField] private SymbolStyle m_StartSymbol = new SymbolStyle() { show = false, type = SymbolType.Circle, size = 3 };
[SerializeField] private SymbolStyle m_EndSymbol = new SymbolStyle() { show = false, type = SymbolType.Circle, size = 3 };
@@ -49,6 +50,7 @@ namespace XCharts.Runtime
m_LineGap = 1.0f;
m_LineLength1 = 25f;
m_LineLength2 = 15f;
m_LineEndX = 0;
}
/// <summary>
@@ -124,6 +126,15 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_LineLength2, value)) SetVerticesDirty(); }
}
/// <summary>
/// The fixed x position of the end point of visual guide line.
/// |视觉引导线结束点的固定x位置。当不为0时会代替lineLength2设定引导线的x位置。
/// </summary>
public float lineEndX
{
get { return m_LineEndX; }
set { if (PropertyUtil.SetStruct(ref m_LineEndX, value)) SetVerticesDirty(); }
}
/// <summary>
/// The symbol of the start point of labelline.
/// |起始点的图形标记。
/// </summary>
@@ -144,12 +155,12 @@ namespace XCharts.Runtime
public Vector3 GetStartSymbolOffset()
{
return m_StartSymbol != null && m_StartSymbol.show? m_StartSymbol.offset3 : Vector3.zero;
return m_StartSymbol != null && m_StartSymbol.show ? m_StartSymbol.offset3 : Vector3.zero;
}
public Vector3 GetEndSymbolOffset()
{
return m_EndSymbol != null && m_EndSymbol.show? m_EndSymbol.offset3 : Vector3.zero;
return m_EndSymbol != null && m_EndSymbol.show ? m_EndSymbol.offset3 : Vector3.zero;
}
}
}

View File

@@ -445,7 +445,6 @@ namespace XCharts.Runtime
ChartHelper.GetHighlightColor(defaltColor, 0.9f) :
labelLine.lineColor;
var isRight = !serie.clockwise;
var dire = isRight ? Vector3.right : Vector3.left;
var rad = Mathf.Deg2Rad * (isRight ? labelLine.lineAngle : 180 - labelLine.lineAngle);
var lineLength1 = ChartHelper.GetActualValue(labelLine.lineLength1, serie.context.outsideRadius);
var pos1 = serieData.context.labelLinePosition;