2019-10-22 04:09:04 +08:00
|
|
|
|
|
2021-01-11 08:54:28 +08:00
|
|
|
|
/************************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/************************************************/
|
2019-10-22 04:09:04 +08:00
|
|
|
|
|
2019-05-24 09:51:45 +08:00
|
|
|
|
using UnityEngine;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
2019-07-15 00:24:04 +08:00
|
|
|
|
[AddComponentMenu("XCharts/LineChart", 13)]
|
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
|
[RequireComponent(typeof(RectTransform))]
|
|
|
|
|
|
[DisallowMultipleComponent]
|
2019-05-11 04:33:54 +08:00
|
|
|
|
public class LineChart : CoordinateChart
|
|
|
|
|
|
{
|
2019-05-15 09:44:18 +08:00
|
|
|
|
|
2019-06-13 09:53:03 +08:00
|
|
|
|
#if UNITY_EDITOR
|
2019-05-11 04:33:54 +08:00
|
|
|
|
protected override void Reset()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Reset();
|
2021-01-11 08:54:28 +08:00
|
|
|
|
title.text = "LineChart";
|
|
|
|
|
|
tooltip.type = Tooltip.Type.Line;
|
2020-07-30 09:31:44 +08:00
|
|
|
|
|
2021-01-11 08:54:28 +08:00
|
|
|
|
visualMap.enable = false;
|
|
|
|
|
|
visualMap.show = false;
|
|
|
|
|
|
visualMap.autoMinMax = true;
|
|
|
|
|
|
visualMap.direction = VisualMap.Direction.Y;
|
|
|
|
|
|
visualMap.inRange.Clear();
|
|
|
|
|
|
visualMap.inRange.Add(Color.blue);
|
|
|
|
|
|
visualMap.inRange.Add(Color.red);
|
2020-07-30 09:31:44 +08:00
|
|
|
|
|
2019-07-15 00:24:04 +08:00
|
|
|
|
RemoveData();
|
2021-01-11 08:54:28 +08:00
|
|
|
|
SerieTemplate.AddDefaultLineSerie(this, "serie1");
|
2019-07-15 00:24:04 +08:00
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddXAxisData("x" + (i + 1));
|
|
|
|
|
|
}
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
2019-06-13 09:53:03 +08:00
|
|
|
|
#endif
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|