diff --git a/Documentation~/en/configuration.md b/Documentation~/en/configuration.md index 1e5c6e26..3ced2a6c 100644 --- a/Documentation~/en/configuration.md +++ b/Documentation~/en/configuration.md @@ -1487,6 +1487,7 @@ Use a line in the chart to illustrate. |--|--|--|--| |show|true||Whether to display the marking line. |serieIndex|0||The serie index of markLine. +|onTop|true|v3.8.2|whether the markline is on top. |animation|||The animation of markline. [AnimationStyle](#animationstyle)| |data|||A list of marked data. When the group of data item is 0, each data item represents a line; When the group is not 0, two data items of the same group represent the starting point and the ending point of the line respectively to form a line. In this case, the relevant style parameters of the line are the parameters of the starting point. @@ -1498,6 +1499,8 @@ Use a line in the chart to illustrate. > XCharts.Runtime.MarkLineData : [ChildComponent](#childcomponent) +> Since `v3.8.2` + Data of marking line. ```mdx-code-block diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index f0be7da6..62e88654 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -69,6 +69,7 @@ slug: /changelog ## master +* (2023.11.01) 增加`MarkLine`的`onTop`设置是否显示在最上层 * (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题 * (2023.10.21) 增加`Axis`的对数轴支持子刻度 * (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题 diff --git a/Documentation~/zh/configuration.md b/Documentation~/zh/configuration.md index 4ef05de9..d1c06842 100644 --- a/Documentation~/zh/configuration.md +++ b/Documentation~/zh/configuration.md @@ -1487,6 +1487,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart |--|--|--|--| |show|true||是否显示标线。 |serieIndex|0||标线影响的Serie索引。 +|onTop|true|v3.8.2|是否在最上层。 |animation|||标线的动画样式。 [AnimationStyle](#animationstyle)| |data|||标线的数据列表。当数据项的group为0时,每个数据项表示一条标线;当group不为0时,相同group的两个数据项分别表 示标线的起始点和终止点来组成一条标线,此时标线的相关样式参数取起始点的参数。 @@ -1498,6 +1499,8 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart > XCharts.Runtime.MarkLineData : [ChildComponent](#childcomponent) +> 从 `v3.8.2` 开始支持 + 图表标线的数据。 ```mdx-code-block diff --git a/Editor/MainComponents/MarkLineEditor.cs b/Editor/MainComponents/MarkLineEditor.cs index 6c8530ae..34e5bd96 100644 --- a/Editor/MainComponents/MarkLineEditor.cs +++ b/Editor/MainComponents/MarkLineEditor.cs @@ -11,6 +11,7 @@ namespace XCharts.Editor { ++EditorGUI.indentLevel; PropertyField("m_SerieIndex"); + PropertyField("m_OnTop"); PropertyField("m_Animation"); PropertyListField("m_Data", true); --EditorGUI.indentLevel; diff --git a/Runtime/Component/Mark/MarkLine.cs b/Runtime/Component/Mark/MarkLine.cs index 3a7b135f..536d2970 100644 --- a/Runtime/Component/Mark/MarkLine.cs +++ b/Runtime/Component/Mark/MarkLine.cs @@ -37,6 +37,7 @@ namespace XCharts.Runtime { [SerializeField] private bool m_Show = true; [SerializeField] private int m_SerieIndex = 0; + [SerializeField][Since("v3.8.2")] private bool m_OnTop = true; [SerializeField] private AnimationStyle m_Animation = new AnimationStyle(); [SerializeField] private List m_Data = new List(); @@ -59,6 +60,15 @@ namespace XCharts.Runtime set { if (PropertyUtil.SetStruct(ref m_SerieIndex, value)) SetVerticesDirty(); } } /// + /// whether the markline is on top. + /// |是否在最上层。 + /// + public bool onTop + { + get { return m_OnTop; } + set { if (PropertyUtil.SetStruct(ref m_OnTop, value)) SetVerticesDirty(); } + } + /// /// The animation of markline. /// |标线的动画样式。 /// diff --git a/Runtime/Component/Mark/MarkLineHandler.cs b/Runtime/Component/Mark/MarkLineHandler.cs index 533b1fbb..13bf6953 100644 --- a/Runtime/Component/Mark/MarkLineHandler.cs +++ b/Runtime/Component/Mark/MarkLineHandler.cs @@ -19,9 +19,16 @@ namespace XCharts.Runtime InitMarkLine(component); } + public override void DrawBase(VertexHelper vh) + { + if (!component.onTop) + DrawMarkLine(vh, component); + } + public override void DrawUpper(VertexHelper vh) { - DrawMarkLine(vh, component); + if (component.onTop) + DrawMarkLine(vh, component); } public override void Update()