using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace XCharts
{
///
/// A data item of serie.
/// 系列中的一个数据项。可存储数据名和1-n维的数据。
///
[System.Serializable]
public class SerieData
{
[SerializeField] private string m_Name;
[SerializeField] private bool m_Selected;
[SerializeField] private List m_Data = new List();
private bool m_Show = true;
///
/// the name of data item.
/// 数据项名称。
///
public string name { get { return m_Name; } set { m_Name = value; } }
///
/// Whether the data item is selected.
/// 该数据项是否被选中。
///
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
///
/// An arbitrary dimension data list of data item.
/// 可指定任意维数的数值列表。
///
public List data { get { return m_Data; } set { m_Data = value; } }
///
/// [default:true] Whether the data item is showed.
/// 该数据项是否要显示。
///
public bool show { get { return m_Show; } set { m_Show = value; } }
///
/// Whether the data item is highlighted.
/// 该数据项是否被高亮,一般由鼠标悬停或图例悬停触发高亮。
///
public bool highlighted { get; set; }
///
/// the label of data item.
/// 该数据项的文本标签。
///
public Text label { get; set; }
///
/// the maxinum value.
/// 最大值。
///
public float max { get { return m_Data.Max(); } }
///
/// the mininum value.
/// 最小值。
///
public float min { get { return m_Data.Min(); } }
public float GetData(int index)
{
if (index >= 0 && index < m_Data.Count) return m_Data[index];
else return 0;
}
}
}