AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
Example80_Polar.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 
9 using UnityEngine;
10 
11 namespace XCharts.Examples
12 {
13  [DisallowMultipleComponent]
14  [ExecuteInEditMode]
15  public class Example80_Polar : MonoBehaviour
16  {
17  private PolarChart chart;
18  private float updateTime;
19 
20  void Awake()
21  {
22  chart = gameObject.GetComponent<PolarChart>();
23  if (chart == null)
24  {
25  chart = gameObject.AddComponent<PolarChart>();
26  }
27  }
28 
29  void Update()
30  {
31  if (Input.GetKeyDown(KeyCode.Space))
32  {
33  AddData();
34  }
35  }
36 
37  void AddData()
38  {
39  chart.RemoveData();
40  chart.tooltip.type = Tooltip.Type.Corss;
41  chart.angleAxis.type = Axis.AxisType.Value;
42  chart.angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;
43  chart.angleAxis.min = 0;
44  chart.angleAxis.max = 360;
45  chart.angleAxis.startAngle = Random.Range(0, 90);
46  chart.AddSerie(SerieType.Line, "line1");
47 
48  var rate = Random.Range(1, 4);
49  for (int i = 0; i <= 360; i++)
50  {
51  var t = i / 180f * Mathf.PI;
52  var r = Mathf.Sin(2 * t) * Mathf.Cos(2 * t) * rate;
53  chart.AddData(0, Mathf.Abs(r), i);
54  }
55  }
56  }
57 }
XCharts.AngleAxis.startAngle
float startAngle
Starting angle of axis. 90 degrees by default, standing for top position of center....
Definition: Axis.cs:1065
XCharts.Tooltip.Type
Type
Indicator type. 指示器类型。
Definition: Tooltip.cs:25
XCharts.Tooltip
Tooltip component. 提示框组件。
Definition: Tooltip.cs:19
XCharts.BaseChart.AddData
virtual SerieData AddData(string serieName, double data, string dataName=null)
Add a data to serie. If serieName doesn't exist in legend,will be add to legend. 添加一个数据到指定的系列中。
Definition: BaseChart_API.cs:237
XCharts.Examples.Example80_Polar
Definition: Example80_Polar.cs:15
XCharts.SerieType
SerieType
the type of serie. 系列类型。
Definition: Serie.cs:19
XCharts.Axis.min
float min
The minimun value of axis.Valid when minMaxType is Custom 设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
Definition: Axis.cs:184
XCharts.BaseChart.tooltip
Tooltip? tooltip
The tooltip setting of chart. 提示框组件
Definition: BaseChart_API.cs:61
XCharts.Axis.type
AxisType type
the type of axis. 坐标轴类型。
Definition: Axis.cs:130
XCharts.Axis
The axis in rectangular coordinate. 直角坐标系的坐标轴组件。
Definition: Axis.cs:20
XCharts.Axis.max
float max
The maximum value of axis.Valid when minMaxType is Custom 设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
Definition: Axis.cs:193
XCharts.Examples
Definition: RewardChart.cs:14
XCharts.BaseChart.AddSerie
virtual Serie AddSerie(SerieType type, string serieName=null, bool show=true, bool addToHead=false)
Add a serie to serie list. 添加一个系列到系列列表中。
Definition: BaseChart_API.cs:199
XCharts.Axis.minMaxType
AxisMinMaxType minMaxType
the type of axis minmax. 坐标轴刻度最大最小值显示类型。
Definition: Axis.cs:139
XCharts.BaseChart.angleAxis
AngleAxis? angleAxis
Angle axis of Polar Coordinate. 极坐标系的角度轴。
Definition: PolarChart_API.cs:20
XCharts.Tooltip.type
Type type
Indicator type. 提示框指示器类型。
Definition: Tooltip.cs:92
XCharts.Axis.AxisType
AxisType
the type of axis. 坐标轴类型。
Definition: Axis.cs:26
XCharts.PolarChart
Definition: PolarChart.cs:20
XCharts.Axis.AxisMinMaxType
AxisMinMaxType
the type of axis min and max value. 坐标轴最大最小刻度显示类型。
Definition: Axis.cs:54
XCharts.BaseChart.RemoveData
virtual void RemoveData()
Remove all data from series and legend. The series list is also cleared. 清除所有系列和图例数据,系列的列表也会被清除。
Definition: BaseChart_API.cs:166