Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AngleAxis.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. /// <summary>
  6. /// Angle axis of Polar Coordinate.
  7. /// |极坐标系的角度轴。
  8. /// </summary>
  9. [System.Serializable]
  10. [RequireChartComponent(typeof(PolarCoord))]
  11. [ComponentHandler(typeof(AngleAxisHandler), true)]
  12. public class AngleAxis : Axis
  13. {
  14. [SerializeField] private float m_StartAngle = 0;
  15. /// <summary>
  16. /// Starting angle of axis. 0 degrees by default, standing for right position of center.
  17. /// |起始刻度的角度,默认为 0 度,即圆心的正右方。
  18. /// </summary>
  19. public float startAngle
  20. {
  21. get { return m_StartAngle; }
  22. set { if (PropertyUtil.SetStruct(ref m_StartAngle, value)) SetAllDirty(); }
  23. }
  24. public float GetValueAngle(float value)
  25. {
  26. return (value + context.startAngle + 360) % 360;
  27. }
  28. public float GetValueAngle(double value)
  29. {
  30. return (float) (value + context.startAngle + 360) % 360;
  31. }
  32. public override void SetDefaultValue()
  33. {
  34. m_Show = true;
  35. m_Type = AxisType.Value;
  36. m_SplitNumber = 12;
  37. m_StartAngle = 0;
  38. m_BoundaryGap = false;
  39. m_Data = new List<string>(12);
  40. splitLine.show = true;
  41. splitLine.lineStyle.type = LineStyle.Type.Solid;
  42. axisLabel.textLimit.enable = false;
  43. minMaxType = AxisMinMaxType.Custom;
  44. min = 0;
  45. max = 360;
  46. }
  47. }
  48. }