説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AxisName.cs 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. /// <summary>
  6. /// the name of axis.
  7. /// |坐标轴名称。
  8. /// </summary>
  9. [Serializable]
  10. public class AxisName : ChildComponent
  11. {
  12. [SerializeField] private bool m_Show;
  13. [SerializeField] private string m_Name;
  14. [SerializeField][Since("v3.1.0")] private bool m_OnZero;
  15. [SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
  16. /// <summary>
  17. /// Whether to show axis name.
  18. /// |是否显示坐标轴名称。
  19. /// </summary>
  20. public bool show
  21. {
  22. get { return m_Show; }
  23. set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
  24. }
  25. /// <summary>
  26. /// the name of axis.
  27. /// |坐标轴名称。
  28. /// </summary>
  29. public string name
  30. {
  31. get { return m_Name; }
  32. set { if (PropertyUtil.SetClass(ref m_Name, value)) SetComponentDirty(); }
  33. }
  34. /// <summary>
  35. /// Whether the axis name position are the same with 0 position of YAxis.
  36. /// |坐标轴名称的位置是否保持和Y轴0刻度一致。
  37. /// </summary>
  38. public bool onZero
  39. {
  40. get { return m_OnZero; }
  41. set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetComponentDirty(); }
  42. }
  43. /// <summary>
  44. /// The text style of axis name.
  45. /// |文本样式。
  46. /// </summary>
  47. public LabelStyle labelStyle
  48. {
  49. get { return m_LabelStyle; }
  50. set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
  51. }
  52. public static AxisName defaultAxisName
  53. {
  54. get
  55. {
  56. var axisName = new AxisName()
  57. {
  58. m_Show = false,
  59. m_Name = "axisName",
  60. m_LabelStyle = new LabelStyle()
  61. };
  62. axisName.labelStyle.position = LabelStyle.Position.End;
  63. return axisName;
  64. }
  65. }
  66. public AxisName Clone()
  67. {
  68. var axisName = new AxisName();
  69. axisName.show = show;
  70. axisName.name = name;
  71. axisName.m_LabelStyle.Copy(m_LabelStyle);
  72. return axisName;
  73. }
  74. public void Copy(AxisName axisName)
  75. {
  76. show = axisName.show;
  77. name = axisName.name;
  78. m_LabelStyle.Copy(axisName.labelStyle);
  79. }
  80. }
  81. }