mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 07:50:16 +00:00
优化代码,更好的支持自定义图表
This commit is contained in:
@@ -209,14 +209,12 @@ namespace XCharts
|
||||
if (m_Flodouts[prop.displayName])
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
//prop.arraySize = EditorGUILayout.IntField("Size", prop.arraySize);
|
||||
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
|
||||
currRect.y -= EditorGUIUtility.singleLineHeight;
|
||||
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
||||
currRect.y + k_IconYOffset,
|
||||
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);
|
||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
||||
|
||||
@@ -471,6 +471,7 @@ namespace XCharts
|
||||
/// <returns></returns>
|
||||
public bool IsDataIndexChanged()
|
||||
{
|
||||
if (runtimeDataIndex.Count < 2 || lastDataIndex.Count < 2) return false;
|
||||
return runtimeDataIndex[0] != lastDataIndex[0] ||
|
||||
runtimeDataIndex[1] != lastDataIndex[1];
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace XCharts
|
||||
int count = 0;
|
||||
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 (count >= 2) return true;
|
||||
|
||||
@@ -583,7 +583,7 @@ namespace XCharts
|
||||
|
||||
public float Internal_GetBarGap()
|
||||
{
|
||||
float gap = 0.3f;
|
||||
float gap = 0f;
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
var serie = m_Series.list[i];
|
||||
@@ -675,7 +675,7 @@ namespace XCharts
|
||||
for (int i = 0; i < m_Series.Count; 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 (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 rate = 0.8f;
|
||||
newColor.r = (byte)(color.r * rate);
|
||||
newColor.g = (byte)(color.g * rate);
|
||||
newColor.b = (byte)(color.b * rate);
|
||||
|
||||
Reference in New Issue
Block a user