优化性能,优化折线图和柱状图的大数据绘制,重构代码

This commit is contained in:
monitor1394
2020-05-13 09:54:40 +08:00
parent d56ed2e086
commit 34f3ef5182
44 changed files with 744 additions and 607 deletions

View File

@@ -75,6 +75,8 @@ namespace XCharts
SerializedProperty m_Ignore = prop.FindPropertyRelative("m_Ignore");
SerializedProperty m_IgnoreValue = prop.FindPropertyRelative("m_IgnoreValue");
SerializedProperty m_ShowAsPositiveNumber = prop.FindPropertyRelative("m_ShowAsPositiveNumber");
SerializedProperty m_Large = prop.FindPropertyRelative("m_Large");
SerializedProperty m_LargeThreshold = prop.FindPropertyRelative("m_LargeThreshold");
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
int index = InitToggle(prop);
@@ -134,6 +136,10 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ShowAsPositiveNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Large);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_LargeThreshold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Symbol);
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
EditorGUI.PropertyField(drawRect, m_LineStyle);
@@ -183,6 +189,10 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ShowAsPositiveNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Large);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_LargeThreshold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
@@ -495,7 +505,7 @@ namespace XCharts
switch (serieType)
{
case SerieType.Line:
height += 17 * EditorGUIUtility.singleLineHeight + 16 * EditorGUIUtility.standardVerticalSpacing;
height += 19 * EditorGUIUtility.singleLineHeight + 18 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineArrow"));
@@ -506,7 +516,7 @@ namespace XCharts
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Bar:
height += 19 * EditorGUIUtility.singleLineHeight + 18 * EditorGUIUtility.standardVerticalSpacing;
height += 21 * EditorGUIUtility.singleLineHeight + 20 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));

View File

@@ -323,7 +323,7 @@ namespace XCharts
m_CustomColorPalette.InsertArrayElementAtIndex(m_CustomColorPalette.arraySize);
}
var customElement = m_CustomColorPalette.GetArrayElementAtIndex(i);
color = customElement.colorValue != Color.clear ?
color = !ChartHelper.IsClearColor(customElement.colorValue) ?
customElement :
m_ColorPalette.GetArrayElementAtIndex(i);
EditorGUI.BeginChangeCheck();