Files
XCharts/Runtime/Component/Axis/AngleAxis/AngleAxis.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2021-11-23 13:20:07 +08:00
using System.Collections.Generic;
using UnityEngine;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2021-11-23 13:20:07 +08:00
{
/// <summary>
/// Angle axis of Polar Coordinate.
2022-03-24 08:37:06 +08:00
/// |极坐标系的角度轴。
2021-11-23 13:20:07 +08:00
/// </summary>
[System.Serializable]
2022-03-31 21:54:34 +08:00
[RequireChartComponent(typeof(PolarCoord))]
2021-11-23 13:20:07 +08:00
[ComponentHandler(typeof(AngleAxisHandler), true)]
public class AngleAxis : Axis
{
2022-01-26 20:47:14 +08:00
[SerializeField] private float m_StartAngle = 0;
2021-11-23 13:20:07 +08:00
/// <summary>
2022-03-24 08:37:06 +08:00
/// Starting angle of axis. 0 degrees by default, standing for right position of center.
/// |起始刻度的角度,默认为 0 度,即圆心的正右方。
2021-11-23 13:20:07 +08:00
/// </summary>
public float startAngle
{
get { return m_StartAngle; }
set { if (PropertyUtil.SetStruct(ref m_StartAngle, value)) SetAllDirty(); }
}
2022-01-26 20:47:14 +08:00
public float GetValueAngle(float value)
{
return (value + context.startAngle + 360) % 360;
}
2021-11-23 13:20:07 +08:00
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Value;
m_SplitNumber = 12;
2022-01-26 20:47:14 +08:00
m_StartAngle = 0;
2021-11-23 13:20:07 +08:00
m_BoundaryGap = false;
m_Data = new List<string>(12);
splitLine.show = true;
splitLine.lineStyle.type = LineStyle.Type.Solid;
axisLabel.textLimit.enable = false;
minMaxType = AxisMinMaxType.Custom;
min = 0;
max = 360;
}
}
}