Files
XCharts/Runtime/Chart/CandlestickChart.cs

32 lines
897 B
C#
Raw Normal View History

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

using UnityEngine;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2021-03-10 13:03:36 +08:00
{
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
{
2022-03-20 18:52:50 +08:00
protected override void DefaultChart()
2021-03-10 13:03:36 +08:00
{
2021-11-23 13:20:07 +08:00
AddChartComponentWhenNoExist<GridCoord>();
AddChartComponentWhenNoExist<XAxis>();
AddChartComponentWhenNoExist<YAxis>();
2022-03-20 18:52:50 +08:00
var tooltip = GetOrAddChartComponent<Tooltip>();
2021-12-19 20:53:55 +08:00
tooltip.type = Tooltip.Type.Shadow;
tooltip.trigger = Tooltip.Trigger.Axis;
2021-03-10 13:03:36 +08:00
RemoveData();
2022-03-20 18:52:50 +08:00
var serie = Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
for (int i = 0; i < serie.dataCount; i++)
2021-03-10 13:03:36 +08:00
{
AddXAxisData("x" + (i + 1));
}
}
}
}