AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
XCharts.ChartTheme Class Reference

Theme. 主题相关配置。 More...

Inheritance diagram for XCharts.ChartTheme:
Collaboration diagram for XCharts.ChartTheme:

Public Member Functions

void SetDefaultFont ()
 
Color32 GetColor (int index)
 Gets the color of the specified index from the palette. 获得调色盘对应系列索引的颜色值。 More...
 
void SetColorPalette (List< Color32 > colorList)
 
void SetColorPalette (List< string > hexColorStringList)
 
void CheckWarning (StringBuilder sb)
 
string GetColorStr (int index)
 Gets the hexadecimal color string of the specified index from the palette. 获得指定索引的十六进制颜色值字符串。 More...
 
void CopyTheme (Theme theme)
 
void CopyTheme (ChartTheme theme)
 copy all configurations from theme. 复制主题的所有配置。 More...
 
void ResetTheme ()
 Clear all custom configurations. 重置,清除所有自定义配置。 More...
 
ChartTheme CloneTheme ()
 克隆主题。 More...
 
void SyncFontName ()
 
void SyncFontToSubComponent ()
 
override int GetHashCode ()
 
- Public Member Functions inherited from XCharts.ChartComponent
virtual void SetVerticesDirty ()
 
virtual void ClearVerticesDirty ()
 
virtual void SetComponentDirty ()
 
virtual void ClearComponentDirty ()
 
virtual void ClearDirty ()
 
virtual void SetAllDirty ()
 

Static Public Member Functions

static Color32 GetColor (string hexColorStr)
 Convert the html string to color. 将字符串颜色值转成Color。 More...
 

Properties

Theme theme [get, set]
 the theme of chart. 主题类型。 More...
 
string themeName [get, set]
 
Color32 contrastColor [get, set]
 the contrast color of chart. 对比色。 More...
 
Color32 backgroundColor [get, set]
 the background color of chart. 背景颜色。 More...
 
string fontName [get, set]
 
int fontInstanceId [get, set]
 
string tmpFontName [get, set]
 
int tmpFontInstanceId [get, set]
 
List< Color32 > colorPalette [get, set]
 The color list of palette. If no color is set in series, the colors would be adopted sequentially and circularly from this list as the colors of series. 调色盘颜色列表。如果系列没有设置颜色,则会依次循环从该列表中取颜色作为系列颜色。 More...
 
ComponentTheme common [get, set]
 
TitleTheme title [get, set]
 
SubTitleTheme subTitle [get, set]
 
LegendTheme legend [get, set]
 
AxisTheme axis [get, set]
 
RadiusAxisTheme radiusAxis [get, set]
 
AngleAxisTheme angleAxis [get, set]
 
PolarAxisTheme polar [get, set]
 
GaugeAxisTheme gauge [get, set]
 
RadarAxisTheme radar [get, set]
 
TooltipTheme tooltip [get, set]
 
DataZoomTheme dataZoom [get, set]
 
VisualMapTheme visualMap [get, set]
 
SerieTheme serie [get, set]
 
Font font [get, set]
 the font of chart text。 字体。 More...
 
static ChartTheme Default [get]
 default theme. 默认主题。 More...
 
static ChartTheme Light [get]
 light theme. 亮主题。 More...
 
static ChartTheme Dark [get]
 dark theme. 暗主题。 More...
 
static ChartTheme EmptyTheme [get]
 
- Properties inherited from XCharts.ChartComponent
virtual bool vertsDirty [get]
 图表重绘标记。 More...
 
virtual bool componentDirty [get]
 组件重新初始化标记。 More...
 
bool anyDirty [get]
 需要重绘图表或重新初始化组件。 More...
 
Painter painter [get, set]
 
Action refreshComponent [get, set]
 
GameObject gameObject [get, set]
 

Additional Inherited Members

- Protected Attributes inherited from XCharts.ChartComponent
bool m_VertsDirty
 
bool m_ComponentDirty
 
Painter m_Painter
 

Detailed Description

Theme. 主题相关配置。

Definition at line 46 of file ChartTheme.cs.

Member Function Documentation

◆ CloneTheme()

ChartTheme XCharts.ChartTheme.CloneTheme ( )
inline

克隆主题。

Returns

Definition at line 372 of file ChartTheme.cs.

373  {
374  var theme = new ChartTheme();
375  InitChartComponentTheme(theme);
376  theme.CopyTheme(this);
377  return theme;
378  }

◆ CopyTheme()

void XCharts.ChartTheme.CopyTheme ( ChartTheme  theme)
inline

copy all configurations from theme. 复制主题的所有配置。

Parameters
theme

Definition at line 310 of file ChartTheme.cs.

311  {
312  m_Theme = theme.theme;
313  m_ThemeName = theme.themeName;
314 #if dUI_TextMeshPro
315  tmpFont = theme.tmpFont;
316 #endif
317  font = theme.font;
318  m_FontName = theme.fontName;
319  m_FontInstacneId = theme.fontInstanceId;
320  m_TMPFontName = theme.tmpFontName;
321  m_TMPFontInstanceId = theme.tmpFontInstanceId;
322  m_ContrastColor = theme.contrastColor;
323  m_BackgroundColor = theme.m_BackgroundColor;
324  m_Common.Copy(theme.common);
325  m_Legend.Copy(theme.m_Legend);
326  m_Title.Copy(theme.m_Title);
327  m_SubTitle.Copy(theme.m_SubTitle);
328  m_Axis.Copy(theme.axis);
329  m_RadiusAxis.Copy(theme.radiusAxis);
330  m_AngleAxis.Copy(theme.angleAxis);
331  m_Polar.Copy(theme.polar);
332  m_Gauge.Copy(theme.gauge);
333  m_Radar.Copy(theme.radar);
334  m_Tooltip.Copy(theme.tooltip);
335  m_DataZoom.Copy(theme.dataZoom);
336  m_VisualMap.Copy(theme.visualMap);
337  m_Serie.Copy(theme.serie);
338  ChartHelper.CopyList(m_ColorPalette, theme.colorPalette);
339  SetAllDirty();
340  }

◆ GetColor() [1/2]

Color32 XCharts.ChartTheme.GetColor ( int  index)
inline

Gets the color of the specified index from the palette. 获得调色盘对应系列索引的颜色值。

Parameters
index编号索引
Returns
the color,or Color.clear when failed.颜色值,失败时返回Color.clear

Definition at line 221 of file ChartTheme.cs.

222  {
223  if (index < 0) index = 0;
224  var newIndex = index < m_ColorPalette.Count ? index : index % m_ColorPalette.Count;
225  if (newIndex < m_ColorPalette.Count)
226  return m_ColorPalette[newIndex];
227  else return Color.clear;
228  }

◆ GetColor() [2/2]

static Color32 XCharts.ChartTheme.GetColor ( string  hexColorStr)
inlinestatic

Convert the html string to color. 将字符串颜色值转成Color。

Parameters
hexColorStr
Returns

Definition at line 572 of file ChartTheme.cs.

573  {
574  Color color;
575  ColorUtility.TryParseHtmlString(hexColorStr, out color);
576  return (Color32)color;
577  }

◆ GetColorStr()

string XCharts.ChartTheme.GetColorStr ( int  index)
inline

Gets the hexadecimal color string of the specified index from the palette. 获得指定索引的十六进制颜色值字符串。

Parameters
index
Returns

Definition at line 274 of file ChartTheme.cs.

275  {
276  if (index < 0)
277  {
278  index = 0;
279  }
280  index = index % m_ColorPalette.Count;
281  if (_colorDic.ContainsKey(index)) return _colorDic[index];
282  else
283  {
284  _colorDic[index] = ColorUtility.ToHtmlStringRGBA(GetColor(index));
285  return _colorDic[index];
286  }
287  }

◆ ResetTheme()

void XCharts.ChartTheme.ResetTheme ( )
inline

Clear all custom configurations. 重置,清除所有自定义配置。

Definition at line 346 of file ChartTheme.cs.

347  {
348  switch (m_Theme)
349  {
350  case Theme.Default: CopyTheme(Default); break;
351  case Theme.Light: CopyTheme(Light); break;
352  case Theme.Dark: CopyTheme(Dark); break;
353  case Theme.Custom:
354  var sourTheme = XThemeMgr.GetTheme(themeName);
355  if (sourTheme != null)
356  {
357  CopyTheme(sourTheme);
358  }
359  else
360  {
361  Debug.LogWarning("ResetTheme:can't find theme:" + themeName + ", reset to Default theme");
362  CopyTheme(Default);
363  }
364  break;
365  }
366  }

Property Documentation

◆ backgroundColor

Color32 XCharts.ChartTheme.backgroundColor
getset

the background color of chart. 背景颜色。

Definition at line 118 of file ChartTheme.cs.

118  {
119  get { return m_BackgroundColor; }
120  set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
121  }

◆ colorPalette

List<Color32> XCharts.ChartTheme.colorPalette
getset

The color list of palette. If no color is set in series, the colors would be adopted sequentially and circularly from this list as the colors of series. 调色盘颜色列表。如果系列没有设置颜色,则会依次循环从该列表中取颜色作为系列颜色。

Definition at line 148 of file ChartTheme.cs.

148 { get { return m_ColorPalette; } set { m_ColorPalette = value; SetVerticesDirty(); } }

◆ contrastColor

Color32 XCharts.ChartTheme.contrastColor
getset

the contrast color of chart. 对比色。

Definition at line 109 of file ChartTheme.cs.

109  {
110  get { return m_ContrastColor; }
111  set { if (PropertyUtil.SetColor(ref m_ContrastColor, value)) SetVerticesDirty(); }
112  }

◆ Dark

ChartTheme XCharts.ChartTheme.Dark
staticget

dark theme. 暗主题。

Definition at line 455 of file ChartTheme.cs.

455  {
456  get
457  {
458  var theme = new ChartTheme();
459  theme.theme = Theme.Dark;
460  theme.themeName = Theme.Dark.ToString();
461  theme.contrastColor = ColorUtil.GetColor("#B9B8CE");
462  theme.backgroundColor = ColorUtil.GetColor("#100C2A");
463  theme.colorPalette = new List<Color32>
464  {
465  ColorUtil.GetColor("#4992ff"),
466  ColorUtil.GetColor("#7cffb2"),
467  ColorUtil.GetColor("#fddd60"),
468  ColorUtil.GetColor("#ff6e76"),
469  ColorUtil.GetColor("#58d9f9"),
470  ColorUtil.GetColor("#05c091"),
471  ColorUtil.GetColor("#ff8a45"),
472  ColorUtil.GetColor("#8d48e3"),
473  ColorUtil.GetColor("#dd79ff"),
474  };
475  InitChartComponentTheme(theme);
476  return theme;
477  }
478  }

◆ Default

ChartTheme XCharts.ChartTheme.Default
staticget

default theme. 默认主题。

Definition at line 387 of file ChartTheme.cs.

387  {
388  get
389  {
390  var theme = new ChartTheme();
391  theme.theme = Theme.Default;
392  theme.themeName = Theme.Default.ToString();
393  theme.contrastColor = ColorUtil.GetColor("#514D4D");
394  theme.backgroundColor = new Color32(255, 255, 255, 255);
395  theme.colorPalette = new List<Color32>
396  {
397  new Color32(194, 53, 49, 255),
398  new Color32(47, 69, 84, 255),
399  new Color32(97, 160, 168, 255),
400  new Color32(212, 130, 101, 255),
401  new Color32(145, 199, 174, 255),
402  new Color32(116, 159, 131, 255),
403  new Color32(202, 134, 34, 255),
404  new Color32(189, 162, 154, 255),
405  new Color32(110, 112, 116, 255),
406  new Color32(84, 101, 112, 255),
407  new Color32(196, 204, 211, 255)
408  };
409  InitChartComponentTheme(theme);
410  return theme;
411  }
412  }

◆ font

Font XCharts.ChartTheme.font
getset

the font of chart text。 字体。

Definition at line 189 of file ChartTheme.cs.

189  {
190  get { return m_Font; }
191  set
192  {
193  m_Font = value;
194  if (value)
195  {
196  m_FontName = value.name;
197  m_FontInstacneId = value.GetInstanceID();
198  }
199  SetComponentDirty();
200  SyncFontToSubComponent();
201  }
202  }

◆ Light

ChartTheme XCharts.ChartTheme.Light
staticget

light theme. 亮主题。

Definition at line 420 of file ChartTheme.cs.

420  {
421  get
422  {
423  var theme = new ChartTheme();
424  theme.theme = Theme.Light;
425  theme.themeName = Theme.Light.ToString();
426  theme.contrastColor = ColorUtil.GetColor("#514D4D");
427  theme.backgroundColor = new Color32(255, 255, 255, 255);
428  theme.colorPalette = new List<Color32>
429  {
430  ColorUtil.GetColor("#37A2DA"),
431  ColorUtil.GetColor("#32C5E9"),
432  ColorUtil.GetColor("#67E0E3"),
433  ColorUtil.GetColor("#9FE6B8"),
434  ColorUtil.GetColor("#FFDB5C"),
435  ColorUtil.GetColor("#ff9f7f"),
436  ColorUtil.GetColor("#fb7293"),
437  ColorUtil.GetColor("#E062AE"),
438  ColorUtil.GetColor("#E690D1"),
439  ColorUtil.GetColor("#e7bcf3"),
440  ColorUtil.GetColor("#9d96f5"),
441  ColorUtil.GetColor("#8378EA"),
442  ColorUtil.GetColor("#96BFFF"),
443  };
444  InitChartComponentTheme(theme);
445  return theme;
446  }
447  }

◆ theme

Theme XCharts.ChartTheme.theme
getset

the theme of chart. 主题类型。

Definition at line 93 of file ChartTheme.cs.

93  {
94  get { return m_Theme; }
95  set { if (PropertyUtil.SetStruct(ref m_Theme, value)) SetComponentDirty(); }
96  }

The documentation for this class was generated from the following file:
XCharts.ChartTheme.font
Font font
the font of chart text。 字体。
Definition: ChartTheme.cs:189
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.ChartTheme.theme
Theme theme
the theme of chart. 主题类型。
Definition: ChartTheme.cs:93
XCharts.ChartTheme.Default
static ChartTheme Default
default theme. 默认主题。
Definition: ChartTheme.cs:387
XCharts.ChartTheme.Dark
static ChartTheme Dark
dark theme. 暗主题。
Definition: ChartTheme.cs:455
XCharts.ChartTheme.Light
static ChartTheme Light
light theme. 亮主题。
Definition: ChartTheme.cs:420