重命名MarkLineType的None为Custom

This commit is contained in:
monitor1394
2025-03-26 22:24:41 +08:00
parent 0b218f6dfe
commit ad3bc75d7c
3 changed files with 24 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_Name"); PropertyField(prop, "m_Name");
switch (type) switch (type)
{ {
case MarkLineType.None: case MarkLineType.Custom:
PropertyField(prop, "m_XPosition"); PropertyField(prop, "m_XPosition");
PropertyField(prop, "m_YPosition"); PropertyField(prop, "m_YPosition");
PropertyField(prop, "m_XValue"); PropertyField(prop, "m_XValue");
@@ -48,7 +48,7 @@ namespace XCharts.Editor
break; break;
} }
PropertyField(prop, "m_Group"); PropertyField(prop, "m_Group");
if (group > 0 && type == MarkLineType.None) PropertyField(prop, "m_ZeroPosition"); if (group > 0 && type == MarkLineType.Custom) PropertyField(prop, "m_ZeroPosition");
PropertyField(prop, "m_LineStyle"); PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_StartSymbol"); PropertyField(prop, "m_StartSymbol");
PropertyField(prop, "m_EndSymbol"); PropertyField(prop, "m_EndSymbol");

View File

@@ -4,25 +4,34 @@ using UnityEngine;
namespace XCharts.Runtime namespace XCharts.Runtime
{ {
/// <summary> /// <summary>
/// 标线类型 /// Mark line type.
/// ||标线类型
/// </summary> /// </summary>
public enum MarkLineType public enum MarkLineType
{ {
None,
/// <summary> /// <summary>
/// 最小值。 /// Custom. You can customize the xy coordinates or values.
/// ||自定义。可自定义xy坐标或数值。
/// </summary>
Custom,
/// <summary>
/// Minimum value.
/// ||最小值。
/// </summary> /// </summary>
Min, Min,
/// <summary> /// <summary>
/// 最大值。 /// Maximum value.
/// ||最大值。
/// </summary> /// </summary>
Max, Max,
/// <summary> /// <summary>
/// 平均值。 /// Average value.
/// ||平均值。
/// </summary> /// </summary>
Average, Average,
/// <summary> /// <summary>
/// 中位数。 /// Median.
/// ||中位数。
/// </summary> /// </summary>
Median Median
} }
@@ -118,7 +127,7 @@ namespace XCharts.Runtime
[System.Serializable] [System.Serializable]
public class MarkLineData : ChildComponent public class MarkLineData : ChildComponent
{ {
[SerializeField] private MarkLineType m_Type = MarkLineType.None; [SerializeField] private MarkLineType m_Type = MarkLineType.Custom;
[SerializeField] private string m_Name; [SerializeField] private string m_Name;
[SerializeField] private int m_Dimension = 1; [SerializeField] private int m_Dimension = 1;
[SerializeField] private float m_XPosition; [SerializeField] private float m_XPosition;
@@ -170,7 +179,7 @@ namespace XCharts.Runtime
} }
/// <summary> /// <summary>
/// The x coordinate relative to the origin, in pixels. /// The x coordinate relative to the origin, in pixels.
/// ||相对原点的 x 坐标单位像素。当type为None时有效。 /// ||相对原点的 x 坐标单位像素。当type为Custom时有效。
/// </summary> /// </summary>
public float xPosition public float xPosition
{ {
@@ -179,7 +188,7 @@ namespace XCharts.Runtime
} }
/// <summary> /// <summary>
/// The y coordinate relative to the origin, in pixels. /// The y coordinate relative to the origin, in pixels.
/// ||相对原点的 y 坐标单位像素。当type为None时有效。 /// ||相对原点的 y 坐标单位像素。当type为Custom时有效。
/// </summary> /// </summary>
public float yPosition public float yPosition
{ {
@@ -188,7 +197,7 @@ namespace XCharts.Runtime
} }
/// <summary> /// <summary>
/// The value specified on the X-axis. A value specified when the X-axis is the category axis represents the index of the category axis data, otherwise a specific value. /// The value specified on the X-axis. A value specified when the X-axis is the category axis represents the index of the category axis data, otherwise a specific value.
/// ||X轴上的指定值。当X轴为类目轴时指定值表示类目轴数据的索引否则为具体的值。当type为None时有效。 /// ||X轴上的指定值。当X轴为类目轴时指定值表示类目轴数据的索引否则为具体的值。当type为Custom时有效。
/// </summary> /// </summary>
public double xValue public double xValue
{ {
@@ -197,7 +206,7 @@ namespace XCharts.Runtime
} }
/// <summary> /// <summary>
/// That's the value on the Y-axis. The value specified when the Y axis is the category axis represents the index of the category axis data, otherwise the specific value. /// That's the value on the Y-axis. The value specified when the Y axis is the category axis represents the index of the category axis data, otherwise the specific value.
/// ||Y轴上的指定值。当Y轴为类目轴时指定值表示类目轴数据的索引否则为具体的值。当type为None时有效。 /// ||Y轴上的指定值。当Y轴为类目轴时指定值表示类目轴数据的索引否则为具体的值。当type为Custom时有效。
/// </summary> /// </summary>
public double yValue public double yValue
{ {

View File

@@ -146,7 +146,7 @@ namespace XCharts.Runtime
data.runtimeValue = SerieHelper.GetMedianData(serie, data.dimension, dataZoom); data.runtimeValue = SerieHelper.GetMedianData(serie, data.dimension, dataZoom);
GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep); GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep);
break; break;
case MarkLineType.None: case MarkLineType.Custom:
if (data.xPosition != 0) if (data.xPosition != 0)
{ {
data.runtimeValue = data.xPosition; data.runtimeValue = data.xPosition;
@@ -303,7 +303,7 @@ namespace XCharts.Runtime
pX = GetAxisPosition(grid, xAxis, dataZoom, serieDataCount, serieData.index); pX = GetAxisPosition(grid, xAxis, dataZoom, serieDataCount, serieData.index);
pY = GetAxisPosition(grid, yAxis, dataZoom, serieDataCount, data.runtimeValue); pY = GetAxisPosition(grid, yAxis, dataZoom, serieDataCount, data.runtimeValue);
return new Vector3(pX, pY); return new Vector3(pX, pY);
case MarkLineType.None: case MarkLineType.Custom:
if (data.zeroPosition) if (data.zeroPosition)
{ {
data.runtimeValue = 0; data.runtimeValue = 0;