RingChart.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEngine;
  2. namespace XCharts.Runtime
  3. {
  4. /// <summary>
  5. /// Ring chart is mainly used to show the proportion of each item and the relationship between the items.
  6. /// || 环形图主要用于显示每一项的比例以及各项之间的关系。
  7. /// </summary>
  8. [AddComponentMenu("XCharts/RingChart", 20)]
  9. [ExecuteInEditMode]
  10. [RequireComponent(typeof(RectTransform))]
  11. [DisallowMultipleComponent]
  12. [HelpURL("https://xcharts-team.github.io/docs/configuration")]
  13. public class RingChart : BaseChart
  14. {
  15. protected override void DefaultChart()
  16. {
  17. GetChartComponent<Tooltip>().type = Tooltip.Type.Line;
  18. RemoveData();
  19. Ring.AddDefaultSerie(this, GenerateDefaultSerieName());
  20. }
  21. /// <summary>
  22. /// default multiple ring chart.
  23. /// || 默认多圆环图。
  24. /// </summary>
  25. public void DefaultMultipleRingChart()
  26. {
  27. CheckChartInit();
  28. var serie = GetSerie(0);
  29. serie.label.show = false;
  30. AddData(0, UnityEngine.Random.Range(30, 90), 100, "data2");
  31. AddData(0, UnityEngine.Random.Range(30, 90), 100, "data3");
  32. }
  33. }
  34. }