增加对自定义Chart的支持

This commit is contained in:
monitor1394
2021-04-22 18:55:56 +08:00
parent 7c762b4455
commit 3507434e7a
17 changed files with 177 additions and 43 deletions

View File

@@ -57,6 +57,7 @@ namespace XCharts
private StringBuilder sb = new StringBuilder();
private bool m_BaseFoldout;
private bool m_CustomFoldout;
protected bool m_ShowAllComponent;
protected Dictionary<string, bool> m_Flodouts = new Dictionary<string, bool>();
@@ -130,7 +131,20 @@ namespace XCharts
EditorGUILayout.PropertyField(m_ChartName);
}
BlockEnd();
var fileds = m_Chart.GetCustomChartInspectorShowFileds();
if (fileds != null && fileds.Length > 0)
{
BlockStart();
m_CustomFoldout = EditorGUILayout.Foldout(m_CustomFoldout, "Custom", true);
if (m_CustomFoldout)
{
foreach (var filed in fileds)
{
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
}
}
BlockEnd();
}
BlockField(m_Theme);
BlockField(m_Settings);
BlockField(m_Background);

View File

@@ -208,6 +208,18 @@ namespace XCharts
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Custom:
var fileds = chart.GetCustomSerieInspectorShowFileds();
if (fileds != null && fileds.Length > 0)
{
foreach (var filed in fileds)
{
PropertyField(prop, filed);
}
}
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
break;
}
PropertyField(prop, "m_Animation");
DrawData(pos, prop, serieType, ref m_DrawRect);

View File

@@ -56,7 +56,7 @@ namespace XCharts
return name;
}
private static void AddChart<T>(string chartName) where T : BaseChart
public static void AddChart<T>(string chartName) where T : BaseChart
{
var parent = GetParent();
if (parent == null) return;