ParallelChart.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. /// <summary>
  6. /// Parallel Coordinates is a common way of visualizing high-dimensional geometry and analyzing multivariate data.
  7. /// || 平行坐标系,通过绘制垂直于坐标轴的平行线来显示数据的一种可视化图表。
  8. /// </summary>
  9. [AddComponentMenu("XCharts/ParallelChart", 25)]
  10. [ExecuteInEditMode]
  11. [RequireComponent(typeof(RectTransform))]
  12. [DisallowMultipleComponent]
  13. [HelpURL("https://xcharts-team.github.io/docs/configuration")]
  14. public class ParallelChart : BaseChart
  15. {
  16. protected override void DefaultChart()
  17. {
  18. RemoveData();
  19. AddChartComponent<ParallelCoord>();
  20. for (int i = 0; i < 3; i++)
  21. {
  22. var valueAxis = AddChartComponent<ParallelAxis>();
  23. valueAxis.type = Axis.AxisType.Value;
  24. }
  25. var categoryAxis = AddChartComponent<ParallelAxis>();
  26. categoryAxis.type = Axis.AxisType.Category;
  27. categoryAxis.position = Axis.AxisPosition.Right;
  28. categoryAxis.data = new List<string>() { "x1", "x2", "x3", "x4", "x5" };
  29. Parallel.AddDefaultSerie(this, GenerateDefaultSerieName());
  30. }
  31. }
  32. }