AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
Example03_ChartAnimation.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 Example03_ChartAnimation : MonoBehaviour
15  {
16  BaseChart chart;
17 
18  void Awake()
19  {
20  chart = gameObject.GetComponent<BaseChart>();
21  if (chart == null)
22  {
23  chart = gameObject.AddComponent<BarChart>();
24  }
25  var serie = chart.series.GetSerie(0);
26  serie.animation.enable = true;
27  //自定义每个数据项的渐入延时
28  serie.animation.customFadeInDelay = CustomFadeInDelay;
29  //自定义每个数据项的渐入时长
30  serie.animation.customFadeInDuration = CustomFadeInDuration;
31  }
32 
33  float CustomFadeInDelay(int dataIndex)
34  {
35  return dataIndex * 1000;
36  }
37 
38  float CustomFadeInDuration(int dataIndex)
39  {
40  return dataIndex * 1000 + 1000;
41  }
42  }
43 }
XCharts.Serie.animation
SerieAnimation animation
The start animation. 起始动画。
Definition: Serie.cs:830
XCharts.Series.GetSerie
Serie GetSerie(string name)
获得指定系列名的第一个系列
Definition: Series.cs:148
XCharts.BarChart
Definition: BarChart_API.cs:14
XCharts.BaseChart.series
Series series
The series setting of chart. 系列列表
Definition: BaseChart_API.cs:66
XCharts.Examples
Definition: RewardChart.cs:14
XCharts.SerieAnimation.enable
bool enable
Whether to enable animation. 是否开启动画效果。
Definition: SerieAnimation.cs:60
XCharts.Examples.Example03_ChartAnimation
Definition: Example03_ChartAnimation.cs:14
XCharts.BaseChart
The base class of all charts. 所有Chart的基类。
Definition: BaseChart_API.cs:21