2021-01-11 08:54:28 +08:00
|
|
|
/************************************************/
|
|
|
|
|
/* */
|
|
|
|
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
/* */
|
|
|
|
|
/************************************************/
|
2019-10-22 04:09:04 +08:00
|
|
|
|
2019-07-13 16:38:38 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
{
|
2019-08-01 23:49:30 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// Settings related to axis line.
|
2021-01-11 08:54:28 +08:00
|
|
|
/// 坐标轴轴线。
|
2019-08-01 23:49:30 +08:00
|
|
|
/// </summary>
|
2020-03-05 20:25:19 +08:00
|
|
|
[System.Serializable]
|
2021-01-11 08:54:28 +08:00
|
|
|
public class AxisLine : BaseLine
|
2019-07-13 16:38:38 +08:00
|
|
|
{
|
2019-07-14 14:34:18 +08:00
|
|
|
[SerializeField] private bool m_OnZero;
|
2021-01-11 08:54:28 +08:00
|
|
|
[SerializeField] private bool m_ShowArrow;
|
|
|
|
|
[SerializeField] private Arrow m_Arrow = new Arrow();
|
2019-07-13 16:38:38 +08:00
|
|
|
|
2019-08-01 23:49:30 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// When mutiple axes exists, this option can be used to specify which axis can be "onZero" to.
|
|
|
|
|
/// X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
|
|
|
|
|
/// </summary>
|
2020-03-05 20:25:19 +08:00
|
|
|
public bool onZero
|
|
|
|
|
{
|
|
|
|
|
get { return m_OnZero; }
|
2021-01-11 08:54:28 +08:00
|
|
|
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
|
2020-03-05 20:25:19 +08:00
|
|
|
}
|
2019-08-01 23:49:30 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether to show the arrow symbol of axis.
|
|
|
|
|
/// 是否显示箭头。
|
|
|
|
|
/// </summary>
|
2021-01-11 08:54:28 +08:00
|
|
|
public bool showArrow
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
2021-01-11 08:54:28 +08:00
|
|
|
get { return m_ShowArrow; }
|
|
|
|
|
set { if (PropertyUtil.SetStruct(ref m_ShowArrow, value)) SetVerticesDirty(); }
|
2020-03-05 20:25:19 +08:00
|
|
|
}
|
2019-08-01 23:49:30 +08:00
|
|
|
/// <summary>
|
2021-01-11 08:54:28 +08:00
|
|
|
/// the arrow of line.
|
|
|
|
|
/// 轴线箭头。
|
2019-08-01 23:49:30 +08:00
|
|
|
/// </summary>
|
2021-01-11 08:54:28 +08:00
|
|
|
public Arrow arrow
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
2021-01-11 08:54:28 +08:00
|
|
|
get { return m_Arrow; }
|
|
|
|
|
set { if (PropertyUtil.SetClass(ref m_Arrow, value)) SetVerticesDirty(); }
|
2020-03-05 20:25:19 +08:00
|
|
|
}
|
2019-07-13 16:38:38 +08:00
|
|
|
public static AxisLine defaultAxisLine
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var axisLine = new AxisLine
|
|
|
|
|
{
|
|
|
|
|
m_Show = true,
|
2019-07-14 14:34:18 +08:00
|
|
|
m_OnZero = true,
|
2021-01-11 08:54:28 +08:00
|
|
|
m_ShowArrow = false,
|
|
|
|
|
m_Arrow = new Arrow(),
|
|
|
|
|
m_LineStyle = new LineStyle(LineStyle.Type.None),
|
2019-07-13 16:38:38 +08:00
|
|
|
};
|
|
|
|
|
return axisLine;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-18 12:31:21 +08:00
|
|
|
|
|
|
|
|
public AxisLine Clone()
|
|
|
|
|
{
|
|
|
|
|
var axisLine = new AxisLine();
|
|
|
|
|
axisLine.show = show;
|
|
|
|
|
axisLine.onZero = onZero;
|
2021-01-11 08:54:28 +08:00
|
|
|
axisLine.showArrow = showArrow;
|
|
|
|
|
axisLine.arrow = arrow.Clone();
|
2020-04-18 12:31:21 +08:00
|
|
|
return axisLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Copy(AxisLine axisLine)
|
|
|
|
|
{
|
2021-01-11 08:54:28 +08:00
|
|
|
base.Copy(axisLine);
|
2020-04-18 12:31:21 +08:00
|
|
|
onZero = axisLine.onZero;
|
2021-01-11 08:54:28 +08:00
|
|
|
showArrow = axisLine.showArrow;
|
|
|
|
|
arrow.Copy(axisLine.arrow);
|
2020-04-18 12:31:21 +08:00
|
|
|
}
|
2019-07-13 16:38:38 +08:00
|
|
|
}
|
|
|
|
|
}
|