mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +00:00
增加GanttChart甘特图
This commit is contained in:
@@ -19,6 +19,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (BarChart)target;
|
||||
}
|
||||
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (CandlestickChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
25
Editor/GanttChartEditor.cs
Normal file
25
Editor/GanttChartEditor.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/GanttChartEditor.cs.meta
Normal file
11
Editor/GanttChartEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1b5a1dfca8e5476b98c807c66783d85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (GaugeChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (HeatmapChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (LineChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (PieChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (RingChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if(target == null) return;
|
||||
m_Chart = (ScatterChart)target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user