Files
XCharts/Runtime/Chart/BarChart.cs

34 lines
884 B
C#
Raw Normal View History

2021-12-24 13:33:09 +08:00

2019-05-24 09:51:45 +08:00
using UnityEngine;
namespace XCharts
{
2021-11-23 13:20:07 +08:00
[AddComponentMenu("XCharts/BarChart", 14)]
2019-07-15 00:24:04 +08:00
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
2021-11-23 13:20:07 +08:00
public partial class BarChart : BaseChart
{
2019-06-13 09:53:03 +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-11-23 13:20:07 +08:00
var tooltip = GetChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Shadow;
tooltip.trigger = Tooltip.Trigger.Axis;
2019-07-15 00:24:04 +08:00
RemoveData();
2021-11-23 13:20:07 +08:00
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
2019-07-15 00:24:04 +08:00
for (int i = 0; i < 5; i++)
{
AddXAxisData("x" + (i + 1));
}
}
2019-06-13 09:53:03 +08:00
#endif
}
}