3.0 - polar chart

This commit is contained in:
monitor1394
2022-01-26 20:47:14 +08:00
parent a32f5f5bcf
commit cc4ee3735c
41 changed files with 566 additions and 165 deletions

View File

@@ -0,0 +1,37 @@

using UnityEngine;
namespace XCharts
{
[AddComponentMenu("XCharts/PolarChart", 23)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class PolarChart : BaseChart
{
#if UNITY_EDITOR
protected override void Reset()
{
base.Reset();
AddChartComponentWhenNoExist<PolarCoord>();
var tooltip = GetChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Corss;
tooltip.trigger = Tooltip.Trigger.Axis;
RemoveData();
var serie = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
serie.SetCoord<PolarCoord>();
serie.ClearData();
for (int i = 0; i <= 360; i++)
{
var t = i / 180f * Mathf.PI;
var r = Mathf.Sin(2 * t) * Mathf.Cos(2 * t) * 2;
AddData(0, Mathf.Abs(r), i);
}
}
#endif
}
}