Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Heatmap.cs 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using UnityEngine;
  2. namespace XCharts.Runtime
  3. {
  4. /// <summary>
  5. /// The mapping type of heatmap.
  6. /// |热力图类型。通过颜色映射划分。
  7. /// </summary>
  8. public enum HeatmapType
  9. {
  10. /// <summary>
  11. /// Data mapping type.By default, the second dimension data is used as the color map.
  12. /// |数据映射型。默认用第2维数据作为颜色映射。要求数据至少有3个维度数据。
  13. /// </summary>
  14. Data,
  15. /// <summary>
  16. /// Number mapping type.The number of occurrences of a statistic in a divided grid, as a color map.
  17. /// |个数映射型。统计数据在划分的格子中出现的次数,作为颜色映射。要求数据至少有2个维度数据。
  18. /// </summary>
  19. Count
  20. }
  21. [System.Serializable]
  22. [SerieHandler(typeof(HeatmapHandler), true)]
  23. [DefaultAnimation(AnimationType.LeftToRight)]
  24. [RequireChartComponent(typeof(VisualMap))]
  25. [CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
  26. [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  27. [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  28. [SerieDataExtraField()]
  29. public class Heatmap : Serie, INeedSerieContainer
  30. {
  31. [SerializeField][Since("v3.3.0")] private HeatmapType m_HeatmapType = HeatmapType.Data;
  32. /// <summary>
  33. /// The mapping type of heatmap.
  34. /// |热力图类型。通过颜色映射划分。
  35. /// </summary>
  36. public HeatmapType heatmapType
  37. {
  38. get { return m_HeatmapType; }
  39. set { if (PropertyUtil.SetStruct(ref m_HeatmapType, value)) { SetVerticesDirty(); } }
  40. }
  41. public int containerIndex { get; internal set; }
  42. public int containterInstanceId { get; internal set; }
  43. public static Serie AddDefaultSerie(BaseChart chart, string serieName)
  44. {
  45. var serie = chart.AddSerie<Heatmap>(serieName);
  46. serie.itemStyle.show = true;
  47. serie.itemStyle.borderWidth = 1;
  48. serie.itemStyle.borderColor = Color.clear;
  49. return serie;
  50. }
  51. }
  52. }