/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System;
using UnityEngine;
namespace XCharts
{
///
/// the name of axis.
/// 坐标轴名称。
///
[Serializable]
public class AxisName : SubComponent
{
///
/// the location of axis name.
/// 坐标轴名称显示位置。
///
public enum Location
{
Start,
Middle,
End
}
[SerializeField] private bool m_Show;
[SerializeField] private string m_Name;
[SerializeField] private Location m_Location;
[SerializeField] private Vector2 m_Offset;
[SerializeField] private float m_Rotate;
[SerializeField] private Color m_Color;
[SerializeField] private int m_FontSize;
[SerializeField] private FontStyle m_FontStyle;
///
/// Whether to show axis name.
/// 是否显示坐标名称。
///
public bool show
{
get { return m_Show; }
set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetComponentDirty(); }
}
///
/// the name of axis.
/// 坐标轴名称。
///
public string name
{
get { return m_Name; }
set { if (PropertyUtility.SetClass(ref m_Name, value)) SetComponentDirty(); }
}
///
/// Location of axis name.
/// 坐标轴名称显示位置。
///
public Location location
{
get { return m_Location; }
set { if (PropertyUtility.SetStruct(ref m_Location, value)) SetComponentDirty(); }
}
///
/// the offset of axis name and axis line.
/// 坐标轴名称与轴线之间的偏移。
///
public Vector2 offset
{
get { return m_Offset; }
set { if (PropertyUtility.SetStruct(ref m_Offset, value)) SetComponentDirty(); }
}
///
/// Rotation of axis name.
/// 坐标轴名字旋转,角度值。
///
public float rotate
{
get { return m_Rotate; }
set { if (PropertyUtility.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
}
///
/// Color of axis name.
/// 坐标轴名称的文字颜色。
///
public Color color
{
get { return m_Color; }
set { if (PropertyUtility.SetColor(ref m_Color, value)) SetComponentDirty(); }
}
///
/// axis name font size.
/// 坐标轴名称的文字大小。
///
public int fontSize
{
get { return m_FontSize; }
set { if (PropertyUtility.SetStruct(ref m_FontSize, value)) SetComponentDirty(); }
}
///
/// axis name font style.
/// 坐标轴名称的文字风格。
///
public FontStyle fontStyle
{
get { return m_FontStyle; }
set { if (PropertyUtility.SetStruct(ref m_FontStyle, value)) SetComponentDirty(); }
}
public static AxisName defaultAxisName
{
get
{
return new AxisName()
{
m_Show = false,
m_Name = "axisName",
m_Location = Location.End,
m_Rotate = 0,
m_Color = Color.clear,
m_FontSize = 18,
m_FontStyle = FontStyle.Normal
};
}
}
public AxisName Clone()
{
var axisName = new AxisName();
axisName.show = show;
axisName.name = name;
axisName.location = location;
axisName.offset = offset;
axisName.rotate = rotate;
axisName.color = color;
axisName.fontSize = fontSize;
axisName.fontStyle = fontStyle;
return axisName;
}
public void Copy(AxisName axisName)
{
show = axisName.show;
name = axisName.name;
location = axisName.location;
offset = axisName.offset;
rotate = axisName.rotate;
color = axisName.color;
fontSize = axisName.fontSize;
fontStyle = axisName.fontStyle;
}
}
}