mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 05:50:09 +00:00
增加DataZoom实现区域缩放
This commit is contained in:
@@ -76,7 +76,8 @@ namespace XCharts
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth -5;
|
||||
m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme", ChartEditorHelper.foldoutStyle);
|
||||
m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme",
|
||||
ChartEditorHelper.foldoutStyle);
|
||||
EditorGUILayout.PropertyField(m_Theme, GUIContent.none);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUIUtility.labelWidth = m_DefaultLabelWidth;
|
||||
@@ -93,7 +94,8 @@ namespace XCharts
|
||||
protected virtual void OnMiddleInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Series,true);
|
||||
m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle, "Base", ChartEditorHelper.foldoutStyle);
|
||||
m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle, "Base",
|
||||
ChartEditorHelper.foldoutStyle);
|
||||
if (m_BaseModuleToggle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BarChart.
|
||||
/// Editor class used to edit UI CoordinateChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(CoordinateChart), false)]
|
||||
@@ -12,6 +12,7 @@ namespace XCharts
|
||||
protected SerializedProperty m_Coordinate;
|
||||
protected SerializedProperty m_XAxis;
|
||||
protected SerializedProperty m_YAxis;
|
||||
protected SerializedProperty m_DataZoom;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -20,11 +21,13 @@ namespace XCharts
|
||||
m_Coordinate = serializedObject.FindProperty("m_Coordinate");
|
||||
m_XAxis = serializedObject.FindProperty("m_XAxis");
|
||||
m_YAxis = serializedObject.FindProperty("m_YAxis");
|
||||
m_DataZoom = serializedObject.FindProperty("m_DataZoom");
|
||||
}
|
||||
|
||||
protected override void OnStartInspectorGUI()
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_DataZoom);
|
||||
EditorGUILayout.PropertyField(m_Coordinate);
|
||||
EditorGUILayout.PropertyField(m_XAxis);
|
||||
EditorGUILayout.PropertyField(m_YAxis);
|
||||
|
||||
83
Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs
Normal file
83
Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(DataZoom), true)]
|
||||
public class DataZoomDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataZoomModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_FilterMode = prop.FindPropertyRelative("m_FilterMode");
|
||||
//SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty m_ShowDataShadow = prop.FindPropertyRelative("m_ShowDataShadow");
|
||||
SerializedProperty m_ShowDetail = prop.FindPropertyRelative("m_ShowDetail");
|
||||
SerializedProperty m_ZoomLock = prop.FindPropertyRelative("m_ZoomLock");
|
||||
SerializedProperty m_Realtime = prop.FindPropertyRelative("m_Realtime");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_Height = prop.FindPropertyRelative("m_Height");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_RangeMode = prop.FindPropertyRelative("m_RangeMode");
|
||||
SerializedProperty m_Start = prop.FindPropertyRelative("m_Start");
|
||||
SerializedProperty m_End = prop.FindPropertyRelative("m_End");
|
||||
//SerializedProperty m_StartValue = prop.FindPropertyRelative("m_StartValue");
|
||||
//SerializedProperty m_EndValue = prop.FindPropertyRelative("m_EndValue");
|
||||
SerializedProperty m_ScrollSensitivity = prop.FindPropertyRelative("m_ScrollSensitivity");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_DataZoomModuleToggle, "DataZoom", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FilterMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
//EditorGUI.PropertyField(drawRect, m_Orient);
|
||||
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDataShadow);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDetail);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ZoomLock);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Realtime);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ScrollSensitivity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Height);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_RangeMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Start);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_End);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
height += 13 * EditorGUIUtility.singleLineHeight + 12 * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs.meta
Normal file
13
Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba26e421f79077499f05aaf10d06b4f
|
||||
timeCreated: 1559609801
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user