Files
XCharts/Runtime/Serie/Radar/Radar.cs

47 lines
1.9 KiB
C#
Raw Normal View History

2021-11-23 13:20:07 +08:00
using System.Collections.Generic;
using UnityEngine;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2021-11-23 13:20:07 +08:00
{
[System.Serializable]
[SerieHandler(typeof(RadarHandler), true)]
[RequireChartComponent(typeof(RadarCoord))]
[SerieExtraComponent(typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
2022-05-22 22:17:38 +08:00
[SerieDataExtraField()]
2021-11-23 13:20:07 +08:00
public class Radar : Serie, INeedSerieContainer
{
2022-10-11 07:00:35 +08:00
[SerializeField][Since("v3.2.0")] private bool m_Smooth = false;
2022-07-17 20:57:38 +08:00
/// <summary>
/// Whether use smooth curve.
/// |是否平滑曲线。平滑曲线时不支持区域填充颜色。
/// </summary>
public bool smooth
{
get { return m_Smooth; }
set { if (PropertyUtil.SetStruct(ref m_Smooth, value)) { SetVerticesDirty(); } }
}
2021-12-19 20:53:55 +08:00
public int containerIndex { get; internal set; }
2021-11-23 13:20:07 +08:00
public int containterInstanceId { get; internal set; }
2022-08-31 22:03:51 +08:00
public override SerieColorBy defaultColorBy { get { return radarType == RadarType.Multiple?SerieColorBy.Data : SerieColorBy.Serie; } }
2022-05-31 08:17:54 +08:00
public override bool multiDimensionLabel { get { return radarType == RadarType.Multiple; } }
2022-05-22 22:17:38 +08:00
2022-01-26 20:47:14 +08:00
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
2021-11-23 13:20:07 +08:00
{
chart.AddChartComponentWhenNoExist<RadarCoord>();
var serie = chart.AddSerie<Radar>(serieName);
serie.symbol.show = true;
2021-12-23 13:23:18 +08:00
serie.symbol.type = SymbolType.Circle;
2021-11-23 13:20:07 +08:00
serie.showDataName = true;
List<double> data = new List<double>();
for (int i = 0; i < 5; i++)
{
data.Add(Random.Range(20, 90));
}
chart.AddData(serie.index, data, "legendName");
2022-01-26 20:47:14 +08:00
return serie;
2021-11-23 13:20:07 +08:00
}
}
}