29 lines
842 B
C#
29 lines
842 B
C#
|
using UnityEngine;
|
||
|
|
||
|
namespace XCharts.Runtime
|
||
|
{
|
||
|
[AddComponentMenu("XCharts/LineChart", 13)]
|
||
|
[ExecuteInEditMode]
|
||
|
[RequireComponent(typeof(RectTransform))]
|
||
|
[DisallowMultipleComponent]
|
||
|
public class LineChart : BaseChart
|
||
|
{
|
||
|
protected override void DefaultChart()
|
||
|
{
|
||
|
AddChartComponentWhenNoExist<GridCoord>();
|
||
|
AddChartComponentWhenNoExist<XAxis>();
|
||
|
AddChartComponentWhenNoExist<YAxis>();
|
||
|
|
||
|
var tooltip = GetOrAddChartComponent<Tooltip>();
|
||
|
tooltip.type = Tooltip.Type.Line;
|
||
|
tooltip.trigger = Tooltip.Trigger.Axis;
|
||
|
|
||
|
RemoveData();
|
||
|
Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||
|
for (int i = 0; i < 5; i++)
|
||
|
{
|
||
|
AddXAxisData("x" + (i + 1));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|