Files
XCharts/Runtime/Chart/RingChart.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2020-03-08 10:47:48 +08:00
using UnityEngine;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2020-03-08 10:47:48 +08:00
{
/// <summary>
/// Ring chart is mainly used to show the proportion of each item and the relationship between the items.
/// || 环形图主要用于显示每一项的比例以及各项之间的关系。
/// </summary>
2020-03-08 10:47:48 +08:00
[AddComponentMenu("XCharts/RingChart", 20)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
2023-06-04 21:52:23 +08:00
[HelpURL("https://xcharts-team.github.io/docs/configuration")]
2021-11-23 13:20:07 +08:00
public class RingChart : BaseChart
2020-03-08 10:47:48 +08:00
{
2022-03-20 18:52:50 +08:00
protected override void DefaultChart()
2020-03-08 10:47:48 +08:00
{
2021-11-23 13:20:07 +08:00
GetChartComponent<Tooltip>().type = Tooltip.Type.Line;
2020-03-08 10:47:48 +08:00
RemoveData();
2021-11-23 13:20:07 +08:00
Ring.AddDefaultSerie(this, GenerateDefaultSerieName());
2020-03-08 10:47:48 +08:00
}
/// <summary>
/// default multiple ring chart.
/// || 默认多圆环图。
/// </summary>
public void DefaultMultipleRingChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.label.show = false;
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data2");
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data3");
}
2020-03-08 10:47:48 +08:00
}
2022-05-22 22:17:38 +08:00
}