重命名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");
switch (type)
{
case MarkLineType.None:
case MarkLineType.Custom:
PropertyField(prop, "m_XPosition");
PropertyField(prop, "m_YPosition");
PropertyField(prop, "m_XValue");
@@ -48,7 +48,7 @@ namespace XCharts.Editor
break;
}
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_StartSymbol");
PropertyField(prop, "m_EndSymbol");

View File

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

View File

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