[feature][heatmap] support heatmapType

This commit is contained in:
monitor1394
2022-09-06 07:22:04 +08:00
parent ce702fd1e3
commit ccc5110e8e
10 changed files with 282 additions and 50 deletions

View File

@@ -2,6 +2,24 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <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
}
[System.Serializable]
[SerieHandler(typeof(HeatmapHandler), true)]
[DefaultAnimation(AnimationType.LeftToRight)]
@@ -11,8 +29,20 @@ namespace XCharts.Runtime
[SerieDataExtraField()]
public class Heatmap : Serie, INeedSerieContainer
{
[SerializeField][Since("3.3.0")] private HeatmapType m_HeatmapType = HeatmapType.Data;
/// <summary>
/// The mapping type of heatmap.
/// |热力图类型。通过颜色映射划分。
/// </summary>
public HeatmapType heatmapType
{
get { return m_HeatmapType; }
set { if (PropertyUtil.SetStruct(ref m_HeatmapType, value)) { SetVerticesDirty(); } }
}
public int containerIndex { get; internal set; }
public int containterInstanceId { get; internal set; }
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
{
var serie = chart.AddSerie<Heatmap>(serieName);