AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
Example13_LineSimple.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using UnityEngine;
9 
10 namespace XCharts.Examples
11 {
12  [DisallowMultipleComponent]
13  [ExecuteInEditMode]
14  public class Example13_LineSimple : MonoBehaviour
15  {
16  void Awake()
17  {
18  var chart = gameObject.GetComponent<LineChart>();
19  if (chart == null)
20  {
21  chart = gameObject.AddComponent<LineChart>();
22  chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸,或直接操作chart.rectTransform
23  }
24  chart.title.show = true;
25  chart.title.text = "Line Simple";
26 
27  chart.tooltip.show = true;
28  chart.legend.show = false;
29 
30  chart.xAxes[0].show = true;
31  chart.xAxes[1].show = false;
32  chart.yAxes[0].show = true;
33  chart.yAxes[1].show = false;
34  chart.xAxes[0].type = Axis.AxisType.Category;
35  chart.yAxes[0].type = Axis.AxisType.Value;
36 
37  chart.xAxes[0].splitNumber = 10;
38  chart.xAxes[0].boundaryGap = true;
39 
40  chart.RemoveData();
41  chart.AddSerie(SerieType.Line);
42  chart.AddSerie(SerieType.Line);
43  for (int i = 0; i < 2000; i++)
44  {
45  chart.AddXAxisData("x" + i);
46  chart.AddData(0, Random.Range(10, 20));
47  chart.AddData(1, Random.Range(10, 20));
48  }
49  }
50  }
51 }
XCharts.Examples.Example13_LineSimple
Definition: Example13_LineSimple.cs:14
XCharts.SerieType
SerieType
the type of serie. 系列类型。
Definition: Serie.cs:19
XCharts.Axis
The axis in rectangular coordinate. 直角坐标系的坐标轴组件。
Definition: Axis.cs:20
XCharts.LineChart
Definition: LineChart.cs:17
XCharts.Examples
Definition: RewardChart.cs:14
XCharts.CoordinateChart.xAxes
List< XAxis > xAxes
the x Axes,xAxes[0] is the first x axis, xAxes[1] is the second x axis. 两个x轴。
Definition: CoordinateChart_API.cs:30
XCharts.Axis.AxisType
AxisType
the type of axis. 坐标轴类型。
Definition: Axis.cs:26