2021-11-23 13:20:07 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
2022-02-19 22:37:57 +08:00
|
|
|
|
namespace XCharts.Runtime
|
2021-11-23 13:20:07 +08:00
|
|
|
|
{
|
2022-09-06 07:22:04 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The mapping type of heatmap.
|
|
|
|
|
|
/// |热力图类型。通过颜色映射划分。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public enum HeatmapType
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Data mapping type.By default, the second dimension data is used as the color map.
|
|
|
|
|
|
/// |数据映射型。默认用第2维数据作为颜色映射。要求数据至少有3个维度数据。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Data,
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Number mapping type.The number of occurrences of a statistic in a divided grid, as a color map.
|
|
|
|
|
|
/// |个数映射型。统计数据在划分的格子中出现的次数,作为颜色映射。要求数据至少有2个维度数据。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Count
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-23 13:20:07 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
|
[SerieHandler(typeof(HeatmapHandler), true)]
|
2021-12-12 18:05:26 +08:00
|
|
|
|
[DefaultAnimation(AnimationType.LeftToRight)]
|
2022-03-09 07:26:15 +08:00
|
|
|
|
[RequireChartComponent(typeof(VisualMap))]
|
2022-09-20 13:16:22 +08:00
|
|
|
|
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
2022-07-25 07:46:03 +08:00
|
|
|
|
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
|
|
|
|
|
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
2022-05-22 22:17:38 +08:00
|
|
|
|
[SerieDataExtraField()]
|
2021-11-23 13:20:07 +08:00
|
|
|
|
public class Heatmap : Serie, INeedSerieContainer
|
|
|
|
|
|
{
|
2022-10-11 07:00:35 +08:00
|
|
|
|
[SerializeField][Since("v3.3.0")] private HeatmapType m_HeatmapType = HeatmapType.Data;
|
2022-09-06 07:22:04 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The mapping type of heatmap.
|
|
|
|
|
|
/// |热力图类型。通过颜色映射划分。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public HeatmapType heatmapType
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_HeatmapType; }
|
|
|
|
|
|
set { if (PropertyUtil.SetStruct(ref m_HeatmapType, value)) { SetVerticesDirty(); } }
|
|
|
|
|
|
}
|
2021-11-23 13:20:07 +08:00
|
|
|
|
public int containerIndex { get; internal set; }
|
|
|
|
|
|
public int containterInstanceId { get; internal set; }
|
2022-09-06 07:22:04 +08:00
|
|
|
|
|
2022-01-26 20:47:14 +08:00
|
|
|
|
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
2021-11-23 13:20:07 +08:00
|
|
|
|
{
|
|
|
|
|
|
var serie = chart.AddSerie<Heatmap>(serieName);
|
|
|
|
|
|
serie.itemStyle.show = true;
|
|
|
|
|
|
serie.itemStyle.borderWidth = 1;
|
|
|
|
|
|
serie.itemStyle.borderColor = Color.clear;
|
2022-01-26 20:47:14 +08:00
|
|
|
|
return serie;
|
2021-11-23 13:20:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|