AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
AxisTheme.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using System;
9 using System.Collections.Generic;
10 using UnityEngine;
11 #if dUI_TextMeshPro
12 using TMPro;
13 #endif
14 
15 namespace XCharts
16 {
17  [Serializable]
19  {
20  [SerializeField] protected LineStyle.Type m_LineType = LineStyle.Type.Solid;
21  [SerializeField] protected float m_LineWidth = 1f;
22  [SerializeField] protected float m_LineLength = 0f;
23  [SerializeField] protected Color32 m_LineColor;
24  [SerializeField] protected LineStyle.Type m_SplitLineType = LineStyle.Type.Dashed;
25  [SerializeField] protected float m_SplitLineWidth = 1f;
26  [SerializeField] protected float m_SplitLineLength = 0f;
27  [SerializeField] protected Color32 m_SplitLineColor;
28  [SerializeField] protected float m_TickWidth = 1f;
29  [SerializeField] protected float m_TickLength = 5f;
30  [SerializeField] protected Color32 m_TickColor;
31  [SerializeField] protected List<Color32> m_SplitAreaColors = new List<Color32>();
32 
37  public LineStyle.Type lineType
38  {
39  get { return m_LineType; }
40  set { if (PropertyUtil.SetStruct(ref m_LineType, value)) SetVerticesDirty(); }
41  }
46  public float lineWidth
47  {
48  get { return m_LineWidth; }
49  set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); }
50  }
55  public float lineLength
56  {
57  get { return m_LineLength; }
58  set { if (PropertyUtil.SetStruct(ref m_LineLength, value)) SetVerticesDirty(); }
59  }
64  public Color32 lineColor
65  {
66  get { return m_LineColor; }
67  set { if (PropertyUtil.SetColor(ref m_LineColor, value)) SetVerticesDirty(); }
68  }
74  {
75  get { return m_SplitLineType; }
76  set { if (PropertyUtil.SetStruct(ref m_SplitLineType, value)) SetVerticesDirty(); }
77  }
82  public float splitLineWidth
83  {
84  get { return m_SplitLineWidth; }
85  set { if (PropertyUtil.SetStruct(ref m_SplitLineWidth, value)) SetVerticesDirty(); }
86  }
91  public float splitLineLength
92  {
93  get { return m_SplitLineLength; }
94  set { if (PropertyUtil.SetStruct(ref m_SplitLineLength, value)) SetVerticesDirty(); }
95  }
100  public Color32 splitLineColor
101  {
102  get { return m_SplitLineColor; }
103  set { if (PropertyUtil.SetColor(ref m_SplitLineColor, value)) SetVerticesDirty(); }
104  }
109  public float tickLength
110  {
111  get { return m_TickLength; }
112  set { if (PropertyUtil.SetStruct(ref m_TickLength, value)) SetVerticesDirty(); }
113  }
118  public float tickWidth
119  {
120  get { return m_TickWidth; }
121  set { if (PropertyUtil.SetStruct(ref m_TickWidth, value)) SetVerticesDirty(); }
122  }
127  public Color32 tickColor
128  {
129  get { return m_TickColor; }
130  set { if (PropertyUtil.SetColor(ref m_TickColor, value)) SetVerticesDirty(); }
131  }
132 
133  public List<Color32> splitAreaColors
134  {
135  get { return m_SplitAreaColors; }
136  set { if (value != null) { m_SplitAreaColors = value; SetVerticesDirty(); } }
137  }
138 
139  public BaseAxisTheme(Theme theme) : base(theme)
140  {
141  m_FontSize = XChartsSettings.fontSizeLv4;
142  m_LineType = XChartsSettings.axisLineType;
143  m_LineWidth = XChartsSettings.axisLineWidth;
144  m_LineLength = 0;
145  m_SplitLineType = XChartsSettings.axisSplitLineType;
146  m_SplitLineWidth = XChartsSettings.axisSplitLineWidth;
147  m_SplitLineLength = 0;
148  m_TickWidth = XChartsSettings.axisTickWidth;
149  m_TickLength = XChartsSettings.axisTickLength;
150  switch (theme)
151  {
152  case Theme.Default:
153  m_LineColor = ColorUtil.GetColor("#514D4D");
154  m_TickColor = ColorUtil.GetColor("#514D4D");
155  m_SplitLineColor = ColorUtil.GetColor("#51515120");
156  m_SplitAreaColors = new List<Color32>{
157  new Color32(250,250,250,77),
158  new Color32(200,200,200,77)
159  };
160  break;
161  case Theme.Light:
162  m_LineColor = ColorUtil.GetColor("#514D4D");
163  m_TickColor = ColorUtil.GetColor("#514D4D");
164  m_SplitLineColor = ColorUtil.GetColor("#51515120");
165  m_SplitAreaColors = new List<Color32>{
166  new Color32(250,250,250,77),
167  new Color32(200,200,200,77)
168  };
169  break;
170  case Theme.Dark:
171  m_LineColor = ColorUtil.GetColor("#B9B8CE");
172  m_TickColor = ColorUtil.GetColor("#B9B8CE");
173  m_SplitLineColor = ColorUtil.GetColor("#484753");
174  m_SplitAreaColors = new List<Color32>{
175  new Color32(255,255,255,(byte)(0.02f * 255)),
176  new Color32(255,255,255,(byte)(0.05f * 255))
177  };
178  break;
179  }
180  }
181 
182  public void Copy(BaseAxisTheme theme)
183  {
184  base.Copy(theme);
185  m_LineType = theme.lineType;
186  m_LineWidth = theme.lineWidth;
187  m_LineLength = theme.lineLength;
188  m_LineColor = theme.lineColor;
189  m_SplitLineType = theme.splitLineType;
190  m_SplitLineWidth = theme.splitLineWidth;
191  m_SplitLineLength = theme.splitLineLength;
192  m_SplitLineColor = theme.splitLineColor;
193  m_TickWidth = theme.tickWidth;
194  m_TickLength = theme.tickLength;
195  m_TickColor = theme.tickColor;
196  ChartHelper.CopyList(m_SplitAreaColors, theme.splitAreaColors);
197  }
198  }
199 
200  [Serializable]
201  public class AxisTheme : BaseAxisTheme
202  {
203  public AxisTheme(Theme theme) : base(theme)
204  {
205  }
206  }
207 
208  [Serializable]
210  {
211  public RadiusAxisTheme(Theme theme) : base(theme)
212  {
213  }
214  }
215 
216  [Serializable]
218  {
219  public AngleAxisTheme(Theme theme) : base(theme)
220  {
221  }
222  }
223 
224  [Serializable]
226  {
227  public PolarAxisTheme(Theme theme) : base(theme)
228  {
229  }
230  }
231 
232  [Serializable]
234  {
235  public RadarAxisTheme(Theme theme) : base(theme)
236  {
237  m_SplitAreaColors.Clear();
238  switch (theme)
239  {
240  case Theme.Dark:
241  m_SplitAreaColors.Add(ChartTheme.GetColor("#6f6f6f"));
242  m_SplitAreaColors.Add(ChartTheme.GetColor("#606060"));
243  break;
244  case Theme.Default:
245  m_SplitAreaColors.Add(ChartTheme.GetColor("#f6f6f6"));
246  m_SplitAreaColors.Add(ChartTheme.GetColor("#e7e7e7"));
247  break;
248  case Theme.Light:
249  m_SplitAreaColors.Add(ChartTheme.GetColor("#f6f6f6"));
250  m_SplitAreaColors.Add(ChartTheme.GetColor("#e7e7e7"));
251  break;
252  }
253  }
254  }
255 }
XCharts.BaseAxisTheme.lineLength
float lineLength
the length of line. 坐标轴线长。
Definition: AxisTheme.cs:56
XCharts.BaseAxisTheme.lineWidth
float lineWidth
the width of line. 坐标轴线宽。
Definition: AxisTheme.cs:47
XCharts.AxisTheme
Definition: AxisTheme.cs:201
XCharts.BaseAxisTheme.tickLength
float tickLength
the length of tick. 刻度线线长。
Definition: AxisTheme.cs:110
XCharts.AngleAxisTheme
Definition: AxisTheme.cs:217
XCharts.BaseAxisTheme.splitLineColor
Color32 splitLineColor
the color of line. 分割线线颜色。
Definition: AxisTheme.cs:101
XCharts.BaseAxisTheme.splitLineType
LineStyle.Type splitLineType
the type of split line. 分割线线类型。
Definition: AxisTheme.cs:74
XCharts.Theme
Theme
主题
Definition: ChartTheme.cs:21
XCharts.ChartTheme.GetColor
Color32 GetColor(int index)
Gets the color of the specified index from the palette. 获得调色盘对应系列索引的颜色值。
Definition: ChartTheme.cs:221
XCharts.LineStyle.Type
Type
线的类型。
Definition: LineStyle.cs:25
XCharts.BaseAxisTheme.lineColor
Color32 lineColor
the color of line. 坐标轴线颜色。
Definition: AxisTheme.cs:65
XCharts
Definition: RewardChart.cs:14
XCharts.RadarAxisTheme
Definition: AxisTheme.cs:233
XCharts.LineStyle
The style of line. 线条样式。 注: 修改 lineStyle 中的颜色不会影响图例颜色,如果需要图例颜色和折线图颜色一致,需修改 itemStyle....
Definition: LineStyle.cs:20
XCharts.BaseAxisTheme.splitLineWidth
float splitLineWidth
the width of split line. 分割线线宽。
Definition: AxisTheme.cs:83
XCharts.BaseAxisTheme.splitLineLength
float splitLineLength
the length of split line. 分割线线长。
Definition: AxisTheme.cs:92
XCharts.BaseAxisTheme.lineType
LineStyle.Type lineType
the type of line. 坐标轴线类型。
Definition: AxisTheme.cs:38
XCharts.RadiusAxisTheme
Definition: AxisTheme.cs:209
XCharts.PolarAxisTheme
Definition: AxisTheme.cs:225
XCharts.ChartTheme
Theme. 主题相关配置。
Definition: ChartTheme.cs:46
XCharts.BaseAxisTheme.tickColor
Color32 tickColor
the color of tick. 坐标轴线颜色。
Definition: AxisTheme.cs:128
XCharts.BaseAxisTheme
Definition: AxisTheme.cs:18
XCharts.BaseAxisTheme.tickWidth
float tickWidth
the width of tick. 刻度线线宽。
Definition: AxisTheme.cs:119
XCharts.ComponentTheme
Definition: ComponentTheme.cs:17