增加GanttChart甘特图

This commit is contained in:
monitor1394
2021-03-25 12:55:52 +08:00
parent e8fdea764c
commit da383c80ae
47 changed files with 968 additions and 72 deletions

View File

@@ -19,6 +19,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (BarChart)target;
}

View File

@@ -123,7 +123,7 @@ namespace XCharts
BlockEnd();
BlockStart();
m_BaseFoldout = EditorGUILayout.Foldout(m_BaseFoldout, "Base");
m_BaseFoldout = EditorGUILayout.Foldout(m_BaseFoldout, "Base", true);
if (m_BaseFoldout)
{
EditorGUILayout.PropertyField(m_Script);
@@ -196,7 +196,7 @@ namespace XCharts
if (all)
{
var flag = m_Flodouts.ContainsKey(prop.displayName) && m_Flodouts[prop.displayName];
m_Flodouts[prop.displayName] = EditorGUILayout.Foldout(flag, prop.displayName);
m_Flodouts[prop.displayName] = EditorGUILayout.Foldout(flag, prop.displayName, true);
if (m_Flodouts[prop.displayName])
{
EditorGUI.indentLevel++;

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (CandlestickChart)target;
}
}

View File

@@ -27,6 +27,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (CoordinateChart)target;
m_Grids = serializedObject.FindProperty("m_Grids");
m_XAxes = serializedObject.FindProperty("m_XAxes");

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI GanttChart.
/// </summary>
[CustomEditor(typeof(GanttChart), false)]
public class GanttChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (GanttChart)target;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1b5a1dfca8e5476b98c807c66783d85
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (GaugeChart)target;
}
}

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (HeatmapChart)target;
}
}

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (LineChart)target;
}
}

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (PieChart)target;
}
}

View File

@@ -22,6 +22,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (PolarChart)target;
m_Polars = serializedObject.FindProperty("m_Polars");
m_RadiusAxes = serializedObject.FindProperty("m_RadiusAxes");

View File

@@ -42,7 +42,7 @@ namespace XCharts
}
EditorGUI.EndChangeCheck();
}
if (type == Axis.AxisType.Value)
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
{
PropertyField(prop, "m_MinMaxType");
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
@@ -60,7 +60,10 @@ namespace XCharts
break;
}
PropertyField(prop, "m_CeilRate");
PropertyField(prop, "m_Inverse");
if (type == Axis.AxisType.Value)
{
PropertyField(prop, "m_Inverse");
}
}
PropertyField(prop, "m_SplitNumber");
if (type == Axis.AxisType.Category)

View File

@@ -197,6 +197,17 @@ namespace XCharts
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Gantt:
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
PropertyField(prop, "m_BarWidth");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
}
PropertyField(prop, "m_Animation");
DrawData(pos, prop, serieType, ref m_DrawRect);
@@ -340,7 +351,7 @@ namespace XCharts
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 4;
var xWid = dataWid - 2;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
@@ -407,7 +418,7 @@ namespace XCharts
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
int.TryParse(str, out index);
}
if (index >= m_DataFoldout.Count)
while (index >= m_DataFoldout.Count)
{
m_DataFoldout.Add(false);
}

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (RingChart)target;
}
}

View File

@@ -18,6 +18,7 @@ namespace XCharts
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (ScatterChart)target;
}
}

View File

@@ -146,11 +146,11 @@ namespace XCharts
AddChart<LiquidChart>("LiquidChart");
}
[MenuItem("XCharts/CandlestickChart", priority = 54)]
[MenuItem("GameObject/XCharts/CandlestickChart", priority = 54)]
public static void AddCandlestickChart()
[MenuItem("XCharts/GanttChart", priority = 54)]
[MenuItem("GameObject/XCharts/GanttChart", priority = 54)]
public static void AddGanttChart()
{
AddChart<CandlestickChart>("CandlestickChart");
AddChart<GanttChart>("GanttChart");
}
[MenuItem("XCharts/Themes Reload")]