Files
XCharts/Runtime/Chart/CandlestickChart.cs

36 lines
922 B
C#
Raw Normal View History

2021-03-10 13:03:36 +08:00

using UnityEngine;
namespace XCharts
{
2021-05-18 00:06:56 +08:00
[AddComponentMenu("XCharts/CandlestickChart", 23)]
2021-03-10 13:03:36 +08:00
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
2021-11-23 13:20:07 +08:00
public class CandlestickChart : BaseChart
2021-03-10 13:03:36 +08:00
{
#if UNITY_EDITOR
protected override void Reset()
{
base.Reset();
2021-11-23 13:20:07 +08:00
AddChartComponentWhenNoExist<GridCoord>();
AddChartComponentWhenNoExist<XAxis>();
AddChartComponentWhenNoExist<YAxis>();
2021-12-19 20:53:55 +08:00
var tooltip = GetChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Shadow;
tooltip.trigger = Tooltip.Trigger.Axis;
2021-03-10 13:03:36 +08:00
RemoveData();
2021-11-23 13:20:07 +08:00
Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
2021-12-31 13:00:17 +08:00
for (int i = 0; i < GetSerie(0).dataCount; i++)
2021-03-10 13:03:36 +08:00
{
AddXAxisData("x" + (i + 1));
}
}
#endif
}
}