mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 20:58:47 +00:00
优化代码,更好的支持自定义图表
This commit is contained in:
@@ -209,14 +209,12 @@ namespace XCharts
|
|||||||
if (m_Flodouts[prop.displayName])
|
if (m_Flodouts[prop.displayName])
|
||||||
{
|
{
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
//prop.arraySize = EditorGUILayout.IntField("Size", prop.arraySize);
|
|
||||||
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
|
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
|
||||||
currRect.y -= EditorGUIUtility.singleLineHeight;
|
currRect.y -= EditorGUIUtility.singleLineHeight;
|
||||||
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
||||||
currRect.y + k_IconYOffset,
|
currRect.y + k_IconYOffset,
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
||||||
EditorGUI.DrawRect(rect1, Color.blue);
|
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd, ChartEditorHelper.Styles.invisibleButton))
|
||||||
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd))// ChartEditorHelper.Styles.invisibleButton))
|
|
||||||
{
|
{
|
||||||
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
|
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
|
||||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ namespace XCharts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsDataIndexChanged()
|
public bool IsDataIndexChanged()
|
||||||
{
|
{
|
||||||
|
if (runtimeDataIndex.Count < 2 || lastDataIndex.Count < 2) return false;
|
||||||
return runtimeDataIndex[0] != lastDataIndex[0] ||
|
return runtimeDataIndex[0] != lastDataIndex[0] ||
|
||||||
runtimeDataIndex[1] != lastDataIndex[1];
|
runtimeDataIndex[1] != lastDataIndex[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ namespace XCharts
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
{
|
{
|
||||||
if (serie.show && serie.type == type)
|
if (serie.show && (serie.type == type || serie.type == SerieType.Custom))
|
||||||
{
|
{
|
||||||
if (stackName.Equals(serie.stack)) count++;
|
if (stackName.Equals(serie.stack)) count++;
|
||||||
if (count >= 2) return true;
|
if (count >= 2) return true;
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public float Internal_GetBarGap()
|
public float Internal_GetBarGap()
|
||||||
{
|
{
|
||||||
float gap = 0.3f;
|
float gap = 0f;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
@@ -675,7 +675,7 @@ namespace XCharts
|
|||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.GetSerie(i);
|
var serie = m_Series.GetSerie(i);
|
||||||
if (serie.type != SerieType.Bar || serie.type == SerieType.Custom) continue;
|
if (serie.type != SerieType.Bar && serie.type != SerieType.Custom) continue;
|
||||||
if (string.IsNullOrEmpty(serie.stack))
|
if (string.IsNullOrEmpty(serie.stack))
|
||||||
{
|
{
|
||||||
if (serie.index == currSerie.index) return index;
|
if (serie.index == currSerie.index) return index;
|
||||||
|
|||||||
@@ -1005,10 +1005,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color32 GetHighlightColor(Color32 color)
|
public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)
|
||||||
{
|
{
|
||||||
var newColor = color;
|
var newColor = color;
|
||||||
var rate = 0.8f;
|
|
||||||
newColor.r = (byte)(color.r * rate);
|
newColor.r = (byte)(color.r * rate);
|
||||||
newColor.g = (byte)(color.g * rate);
|
newColor.g = (byte)(color.g * rate);
|
||||||
newColor.b = (byte)(color.b * rate);
|
newColor.b = (byte)(color.b * rate);
|
||||||
|
|||||||
Reference in New Issue
Block a user