增加SerieData可单独设置SerieSymbol#66

This commit is contained in:
monitor1394
2020-06-17 12:46:04 +08:00
parent c187226465
commit 17c8b76c54
17 changed files with 114 additions and 41 deletions

View File

@@ -30,6 +30,8 @@ namespace XCharts
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
[SerializeField] private bool m_EnableEmphasis = false;
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
[SerializeField] private bool m_EnableSymbol = false;
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
[SerializeField] private List<float> m_Data = new List<float>();
public LabelObject labelObject { get; set; }
@@ -87,6 +89,14 @@ namespace XCharts
/// </summary>
public Emphasis emphasis { get { return m_Emphasis; } set { m_Emphasis = value; } }
/// <summary>
/// 是否启用单个数据项的标记设置。
/// </summary>
public bool enableSymbol { get { return m_EnableSymbol; } set { m_EnableSymbol = value; } }
/// <summary>
/// 单个数据项的标记设置。
/// </summary>
public SerieSymbol symbol { get { return m_Symbol; } set { m_Symbol = value; } }
/// <summary>
/// An arbitrary dimension data list of data item.
/// 可指定任意维数的数值列表。
/// </summary>
@@ -169,6 +179,10 @@ namespace XCharts
m_Name = string.Empty;
m_Selected = false;
m_CanShowLabel = false;
m_EnableSymbol = false;
m_EnableLabel = false;
m_EnableEmphasis = false;
m_EnableItemStyle = false;
m_Radius = 0;
m_Data.Clear();
m_PreviousData.Clear();

View File

@@ -78,6 +78,7 @@ namespace XCharts
[System.Serializable]
public class SerieSymbol : SubComponent
{
[SerializeField] private bool m_Show = false;
[SerializeField] private SerieSymbolType m_Type = SerieSymbolType.EmptyCircle;
[SerializeField] private SerieSymbolSizeType m_SizeType = SerieSymbolSizeType.Custom;
[SerializeField] private float m_Size = 6f;
@@ -92,6 +93,33 @@ namespace XCharts
[SerializeField] private bool m_ForceShowLast = false;
[SerializeField] private float m_Gap = 0;
public void Reset()
{
m_Show = false;
m_Type = SerieSymbolType.EmptyCircle;
m_SizeType = SerieSymbolSizeType.Custom;
m_Size = 6f;
m_SelectedDataScale = 10f;
m_DataIndex = 1;
m_DataScale = 1;
m_SelectedDataScale = 1.5f;
m_SizeCallback = null;
m_SelectedSizeCallback = null;
m_StartIndex = 0;
m_Interval = 0;
m_ForceShowLast = false;
m_Gap = 0;
}
/// <summary>
/// Whether the symbol is showed.
/// 是否显示标记。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetAllDirty(); }
}
/// <summary>
/// the type of symbol.
/// 标记类型。
@@ -274,7 +302,7 @@ namespace XCharts
public bool ShowSymbol(int dataIndex, int dataCount)
{
if (type == SerieSymbolType.None) return false;
if (!show) return false;
if (dataIndex < startIndex) return false;
if (m_Interval <= 0) return true;
if (m_ForceShowLast && dataIndex == dataCount - 1) return true;