mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
serie增加自定义参数
This commit is contained in:
@@ -182,6 +182,18 @@ namespace XCharts
|
||||
PropertyField(prop, filed);
|
||||
}
|
||||
}
|
||||
var customs = chart.GetCustomSerieInspectorCustomFileds();
|
||||
if (customs != null && customs.Length > 0)
|
||||
{
|
||||
foreach (var custom in customs)
|
||||
{
|
||||
var customProp = prop.FindPropertyRelative(custom[0]);
|
||||
var anatherName = custom[1] + " (" + customProp.displayName + ")";
|
||||
EditorGUI.PropertyField(m_DrawRect, customProp, new GUIContent(anatherName));
|
||||
m_DrawRect.y += EditorGUI.GetPropertyHeight(prop);
|
||||
m_Heights[m_KeyName] += hig;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
|
||||
@@ -196,9 +196,9 @@ namespace XCharts
|
||||
/// <param name="type">the type of serie</param>
|
||||
/// <param name="show">whether to show this serie</param>
|
||||
/// <returns>the added serie</returns>
|
||||
public virtual Serie AddSerie(SerieType type, string serieName = null, bool show = true)
|
||||
public virtual Serie AddSerie(SerieType type, string serieName = null, bool show = true, bool addToHead = false)
|
||||
{
|
||||
return m_Series.AddSerie(type, serieName);
|
||||
return m_Series.AddSerie(type, serieName, addToHead);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -209,7 +209,7 @@ namespace XCharts
|
||||
/// <param name="serieName"></param>
|
||||
/// <param name="show"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Serie AddSerie(string serieType, string serieName = null, bool show = true)
|
||||
public virtual Serie AddSerie(string serieType, string serieName = null, bool show = true, bool addToHead = false)
|
||||
{
|
||||
var type = SerieType.Custom;
|
||||
var list = Enum.GetNames(typeof(SerieType));
|
||||
@@ -217,7 +217,7 @@ namespace XCharts
|
||||
{
|
||||
if (t.Equals(serieType)) type = (SerieType)Enum.Parse(typeof(SerieType), t);
|
||||
}
|
||||
return AddSerie(type, serieName, show);
|
||||
return AddSerie(type, serieName, show, addToHead);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -761,6 +761,10 @@ namespace XCharts
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual string[][] GetCustomSerieInspectorCustomFileds()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual string[] GetCustomChartInspectorShowFileds()
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -307,6 +307,12 @@ namespace XCharts
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
[SerializeField] private bool m_CustomBool1;
|
||||
[SerializeField] private bool m_CustomBool2;
|
||||
[SerializeField] private int m_CustomInt1;
|
||||
[SerializeField] private int m_CustomInt2;
|
||||
[SerializeField] private float m_CustomFloat1;
|
||||
[SerializeField] private float m_CustomFloat2;
|
||||
|
||||
[SerializeField] private List<SerieData> m_Data = new List<SerieData>();
|
||||
|
||||
@@ -928,6 +934,36 @@ namespace XCharts
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
|
||||
}
|
||||
public bool customBool1
|
||||
{
|
||||
get { return m_CustomBool1; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomBool1, value)) SetAllDirty(); }
|
||||
}
|
||||
public bool customBool2
|
||||
{
|
||||
get { return m_CustomBool2; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomBool2, value)) SetAllDirty(); }
|
||||
}
|
||||
public int customInt1
|
||||
{
|
||||
get { return m_CustomInt1; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomInt1, value)) SetAllDirty(); }
|
||||
}
|
||||
public int customInt2
|
||||
{
|
||||
get { return m_CustomInt2; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomInt2, value)) SetAllDirty(); }
|
||||
}
|
||||
public float customFloat1
|
||||
{
|
||||
get { return m_CustomFloat1; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomFloat1, value)) SetAllDirty(); }
|
||||
}
|
||||
public float customFloat2
|
||||
{
|
||||
get { return m_CustomFloat2; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CustomFloat2, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
||||
/// </summary>
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace XCharts
|
||||
/// <param name="type"></param>
|
||||
/// <param name="show"></param>
|
||||
/// <returns></returns>
|
||||
public Serie AddSerie(SerieType type, string serieName, bool show = true)
|
||||
public Serie AddSerie(SerieType type, string serieName, bool show = true, bool addToHead = false)
|
||||
{
|
||||
var serie = new Serie();
|
||||
serie.type = type;
|
||||
@@ -277,7 +277,8 @@ namespace XCharts
|
||||
serie.symbol.show = false;
|
||||
}
|
||||
serie.animation.Restart();
|
||||
m_Series.Add(serie);
|
||||
if (addToHead) m_Series.Insert(0, serie);
|
||||
else m_Series.Add(serie);
|
||||
SetVerticesDirty();
|
||||
return serie;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user