mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 01:10:08 +00:00
3.0 - unitypackage
This commit is contained in:
78
Runtime/Component/Axis/AxisLine.cs
Normal file
78
Runtime/Component/Axis/AxisLine.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis line.
|
||||
/// 坐标轴轴线。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AxisLine : BaseLine
|
||||
{
|
||||
[SerializeField] private bool m_OnZero;
|
||||
[SerializeField] private bool m_ShowArrow;
|
||||
[SerializeField] private ArrowStyle m_Arrow = new ArrowStyle();
|
||||
|
||||
/// <summary>
|
||||
/// When mutiple axes exists, this option can be used to specify which axis can be "onZero" to.
|
||||
/// X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
|
||||
/// </summary>
|
||||
public bool onZero
|
||||
{
|
||||
get { return m_OnZero; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the arrow symbol of axis.
|
||||
/// 是否显示箭头。
|
||||
/// </summary>
|
||||
public bool showArrow
|
||||
{
|
||||
get { return m_ShowArrow; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowArrow, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the arrow of line.
|
||||
/// 轴线箭头。
|
||||
/// </summary>
|
||||
public ArrowStyle arrow
|
||||
{
|
||||
get { return m_Arrow; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Arrow, value)) SetVerticesDirty(); }
|
||||
}
|
||||
public static AxisLine defaultAxisLine
|
||||
{
|
||||
get
|
||||
{
|
||||
var axisLine = new AxisLine
|
||||
{
|
||||
m_Show = true,
|
||||
m_OnZero = true,
|
||||
m_ShowArrow = false,
|
||||
m_Arrow = new ArrowStyle(),
|
||||
m_LineStyle = new LineStyle(LineStyle.Type.None),
|
||||
};
|
||||
return axisLine;
|
||||
}
|
||||
}
|
||||
|
||||
public AxisLine Clone()
|
||||
{
|
||||
var axisLine = new AxisLine();
|
||||
axisLine.show = show;
|
||||
axisLine.onZero = onZero;
|
||||
axisLine.showArrow = showArrow;
|
||||
axisLine.arrow = arrow.Clone();
|
||||
return axisLine;
|
||||
}
|
||||
|
||||
public void Copy(AxisLine axisLine)
|
||||
{
|
||||
base.Copy(axisLine);
|
||||
onZero = axisLine.onZero;
|
||||
showArrow = axisLine.showArrow;
|
||||
arrow.Copy(axisLine.arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user