mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 12:48:47 +00:00
整理代码
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,10 +1,9 @@
|
|||||||
/.vs
|
/.vs
|
||||||
|
/.vscode
|
||||||
.vs
|
.vs
|
||||||
/Library
|
/Library
|
||||||
/Temp
|
/Temp
|
||||||
/UnityPackageManager
|
/UnityPackageManager
|
||||||
/Assets/XLua/Examples
|
|
||||||
|
|
||||||
/Assets/XCharts/Demo/demo_test.unity
|
/Assets/XCharts/Demo/demo_test.unity
|
||||||
/Assets/XCharts/Demo/demo_test.unity.meta
|
/Assets/XCharts/Demo/demo_test.unity.meta
|
||||||
@@ -15,4 +14,6 @@
|
|||||||
*.vcxproj.user
|
*.vcxproj.user
|
||||||
*.pdb
|
*.pdb
|
||||||
*.exp
|
*.exp
|
||||||
*.apk
|
*.apk
|
||||||
|
*.DS_Store
|
||||||
|
*.cache
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using XCharts;
|
using XCharts;
|
||||||
|
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ public class Demo_LargeData : MonoBehaviour
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (initCount< maxCacheDataNumber)
|
if (initCount < maxCacheDataNumber)
|
||||||
{
|
{
|
||||||
int count = (int)(maxCacheDataNumber / initDataTime * Time.deltaTime);
|
int count = (int)(maxCacheDataNumber / initDataTime * Time.deltaTime);
|
||||||
for(int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
timeNow = timeNow.AddSeconds(1);
|
timeNow = timeNow.AddSeconds(1);
|
||||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ public class Demo_PieChart : MonoBehaviour
|
|||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
time += Time.deltaTime;
|
time += Time.deltaTime;
|
||||||
if(time > 1 )
|
if (time > 1)
|
||||||
{
|
{
|
||||||
time = 0;
|
time = 0;
|
||||||
if(count < 5)
|
if (count < 5)
|
||||||
{
|
{
|
||||||
chart.AddData("time" + count, Random.Range(10, 100));
|
chart.AddData("time" + count, Random.Range(10, 100));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using XCharts;
|
using XCharts;
|
||||||
|
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using UnityEditor;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
@@ -33,8 +32,8 @@ namespace XCharts
|
|||||||
|
|
||||||
private bool m_ThemeModuleToggle = false;
|
private bool m_ThemeModuleToggle = false;
|
||||||
private bool m_BaseModuleToggle = false;
|
private bool m_BaseModuleToggle = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected virtual void OnEnable()
|
protected virtual void OnEnable()
|
||||||
{
|
{
|
||||||
@@ -75,7 +74,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
EditorGUILayout.PropertyField(m_Script);
|
EditorGUILayout.PropertyField(m_Script);
|
||||||
EditorGUILayout.BeginHorizontal();
|
EditorGUILayout.BeginHorizontal();
|
||||||
EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth -5;
|
EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth - 5;
|
||||||
m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme",
|
m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme",
|
||||||
ChartEditorHelper.foldoutStyle);
|
ChartEditorHelper.foldoutStyle);
|
||||||
EditorGUILayout.PropertyField(m_Theme, GUIContent.none);
|
EditorGUILayout.PropertyField(m_Theme, GUIContent.none);
|
||||||
@@ -93,7 +92,7 @@ namespace XCharts
|
|||||||
|
|
||||||
protected virtual void OnMiddleInspectorGUI()
|
protected virtual void OnMiddleInspectorGUI()
|
||||||
{
|
{
|
||||||
EditorGUILayout.PropertyField(m_Series,true);
|
EditorGUILayout.PropertyField(m_Series, true);
|
||||||
m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle, "Base",
|
m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle, "Base",
|
||||||
ChartEditorHelper.foldoutStyle);
|
ChartEditorHelper.foldoutStyle);
|
||||||
if (m_BaseModuleToggle)
|
if (m_BaseModuleToggle)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditorInternal;
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -107,7 +106,7 @@ namespace XCharts
|
|||||||
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||||
|
|
||||||
if (type == Axis.AxisType.Category)
|
if (type == Axis.AxisType.Category)
|
||||||
{
|
{
|
||||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||||
@@ -154,11 +153,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||||
}
|
}
|
||||||
}else if(type == Axis.AxisType.Value)
|
}
|
||||||
|
else if (type == Axis.AxisType.Value)
|
||||||
{
|
{
|
||||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||||
if(m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
|
if (m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
|
||||||
{
|
{
|
||||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ namespace XCharts
|
|||||||
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -22,7 +21,7 @@ namespace XCharts
|
|||||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||||
|
|
||||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CoordinateModuleToggle, "Coordinate");
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CoordinateModuleToggle, "Coordinate");
|
||||||
EditorGUI.LabelField(drawRect, "Coordinate",EditorStyles.boldLabel);
|
EditorGUI.LabelField(drawRect, "Coordinate", EditorStyles.boldLabel);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
if (m_CoordinateModuleToggle)
|
if (m_CoordinateModuleToggle)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -63,7 +62,7 @@ namespace XCharts
|
|||||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||||
height += EditorGUI.GetPropertyHeight(location);
|
height += EditorGUI.GetPropertyHeight(location);
|
||||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
if (m_DataFoldout)
|
if (m_DataFoldout)
|
||||||
{
|
{
|
||||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -49,7 +48,7 @@ namespace XCharts
|
|||||||
if (m_Point.boolValue)
|
if (m_Point.boolValue)
|
||||||
{
|
{
|
||||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||||
EditorGUI.LabelField(drawRect,"Width");
|
EditorGUI.LabelField(drawRect, "Width");
|
||||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||||
if (tempWidth < 20) tempWidth = 20;
|
if (tempWidth < 20) tempWidth = 20;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -63,13 +62,13 @@ namespace XCharts
|
|||||||
if (m_RadarModuleToggle)
|
if (m_RadarModuleToggle)
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
|
|
||||||
EditorGUIUtility.fieldWidth = 10;
|
EditorGUIUtility.fieldWidth = 10;
|
||||||
|
|
||||||
EditorGUIUtility.labelWidth = 50;
|
EditorGUIUtility.labelWidth = 50;
|
||||||
drawRect.width = 60;
|
drawRect.width = 60;
|
||||||
EditorGUI.PropertyField(drawRect, m_Cricle);
|
EditorGUI.PropertyField(drawRect, m_Cricle);
|
||||||
|
|
||||||
EditorGUIUtility.labelWidth = 45;
|
EditorGUIUtility.labelWidth = 45;
|
||||||
drawRect.x += 60;
|
drawRect.x += 60;
|
||||||
EditorGUI.PropertyField(drawRect, m_Area);
|
EditorGUI.PropertyField(drawRect, m_Area);
|
||||||
@@ -129,7 +128,7 @@ namespace XCharts
|
|||||||
if (m_RadarModuleToggle)
|
if (m_RadarModuleToggle)
|
||||||
{
|
{
|
||||||
propNum += 13;
|
propNum += 13;
|
||||||
|
|
||||||
if (m_BackgroundColorToggle)
|
if (m_BackgroundColorToggle)
|
||||||
{
|
{
|
||||||
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
||||||
@@ -139,14 +138,14 @@ namespace XCharts
|
|||||||
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
||||||
|
|
||||||
|
|
||||||
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum -1) * EditorGUIUtility.standardVerticalSpacing;
|
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
if (m_IndicatorToggle)
|
if (m_IndicatorToggle)
|
||||||
{
|
{
|
||||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
for(int i = 0; i < m_IndicatorSize; i++)
|
for (int i = 0; i < m_IndicatorSize; i++)
|
||||||
{
|
{
|
||||||
height += EditorGUI.GetPropertyHeight(m_IndicatorList.GetArrayElementAtIndex(i));
|
height += EditorGUI.GetPropertyHeight(m_IndicatorList.GetArrayElementAtIndex(i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -31,12 +30,12 @@ namespace XCharts
|
|||||||
if (m_RadarModuleToggle)
|
if (m_RadarModuleToggle)
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
|
|
||||||
EditorGUI.PropertyField(drawRect, m_Name);
|
EditorGUI.PropertyField(drawRect, m_Name);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_Max);
|
EditorGUI.PropertyField(drawRect, m_Max);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +46,7 @@ namespace XCharts
|
|||||||
if (m_RadarModuleToggle)
|
if (m_RadarModuleToggle)
|
||||||
{
|
{
|
||||||
propNum += 2;
|
propNum += 2;
|
||||||
return propNum * EditorGUIUtility.singleLineHeight + (propNum -1) * EditorGUIUtility.standardVerticalSpacing;
|
return propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using UnityEditor;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditorInternal;
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -27,7 +26,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||||
{
|
{
|
||||||
if(m_TooltipModuleToggle)
|
if (m_TooltipModuleToggle)
|
||||||
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
||||||
else
|
else
|
||||||
return 1 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
return 1 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using UnityEngine;
|
namespace XCharts
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
{
|
||||||
public interface IJsonData
|
public interface IJsonData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using UnityEngine;
|
namespace XCharts
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
{
|
||||||
public interface IPropertyChanged
|
public interface IPropertyChanged
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace XCharts
|
|||||||
m_Data.Add(category);
|
m_Data.Add(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetData(int index,DataZoom dataZoom)
|
public string GetData(int index, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
var showData = GetData(dataZoom);
|
var showData = GetData(dataZoom);
|
||||||
if (index >= 0 && index < showData.Count)
|
if (index >= 0 && index < showData.Count)
|
||||||
@@ -131,10 +131,10 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (dataZoom != null && dataZoom.show)
|
if (dataZoom != null && dataZoom.show)
|
||||||
{
|
{
|
||||||
var startIndex = (int)((data.Count-1) * dataZoom.start / 100);
|
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||||
if(filterData == null || filterData.Count != count)
|
if (filterData == null || filterData.Count != count)
|
||||||
{
|
{
|
||||||
UpdateFilterData(dataZoom);
|
UpdateFilterData(dataZoom);
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||||
if(startIndex != filterStart || endIndex != filterEnd)
|
if (startIndex != filterStart || endIndex != filterEnd)
|
||||||
{
|
{
|
||||||
filterStart = startIndex;
|
filterStart = startIndex;
|
||||||
filterEnd = endIndex;
|
filterEnd = endIndex;
|
||||||
@@ -166,7 +166,7 @@ namespace XCharts
|
|||||||
filterData = m_Data;
|
filterData = m_Data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(endIndex == 0)
|
else if (endIndex == 0)
|
||||||
{
|
{
|
||||||
filterData = new List<string>();
|
filterData = new List<string>();
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ namespace XCharts
|
|||||||
return dataCount;
|
return dataCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetSplitWidth(float coordinateWidth,DataZoom dataZoom)
|
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
return coordinateWidth / (m_BoundaryGap ? GetSplitNumber(dataZoom) : GetSplitNumber(dataZoom) - 1);
|
return coordinateWidth / (m_BoundaryGap ? GetSplitNumber(dataZoom) : GetSplitNumber(dataZoom) - 1);
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetScaleWidth(float coordinateWidth,DataZoom dataZoom)
|
public float GetScaleWidth(float coordinateWidth, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
int num = GetScaleNumber(dataZoom) - 1;
|
int num = GetScaleNumber(dataZoom) - 1;
|
||||||
if (num <= 0) num = 1;
|
if (num <= 0) num = 1;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System;
|
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
@@ -162,7 +161,6 @@ namespace XCharts
|
|||||||
m_Tooltip.SetActive(false);
|
m_Tooltip.SetActive(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Tooltip.SetActive(true);
|
|
||||||
if (m_Series.Count == 1)
|
if (m_Series.Count == 1)
|
||||||
{
|
{
|
||||||
float value = m_Series.GetData(0, index);
|
float value = m_Series.GetData(0, index);
|
||||||
@@ -221,6 +219,7 @@ namespace XCharts
|
|||||||
pos.y = m_Tooltip.height;
|
pos.y = m_Tooltip.height;
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(pos);
|
m_Tooltip.UpdateContentPos(pos);
|
||||||
|
m_Tooltip.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnThemeChanged()
|
protected override void OnThemeChanged()
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
@@ -84,7 +82,7 @@ namespace XCharts
|
|||||||
rangeMode = RangeMode.Percent,
|
rangeMode = RangeMode.Percent,
|
||||||
start = 30,
|
start = 30,
|
||||||
end = 70,
|
end = 70,
|
||||||
m_ScrollSensitivity=10,
|
m_ScrollSensitivity = 10,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +117,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public void SetLabelActive(bool flag)
|
public void SetLabelActive(bool flag)
|
||||||
{
|
{
|
||||||
if(startLabel && startLabel.gameObject.activeInHierarchy!=flag)
|
if (startLabel && startLabel.gameObject.activeInHierarchy != flag)
|
||||||
{
|
{
|
||||||
startLabel.gameObject.SetActive(flag);
|
startLabel.gameObject.SetActive(flag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
public class JsonDataSupport: IJsonData,ISerializationCallbackReceiver
|
public class JsonDataSupport : IJsonData, ISerializationCallbackReceiver
|
||||||
{
|
{
|
||||||
[SerializeField] protected string m_JsonData;
|
[SerializeField] protected string m_JsonData;
|
||||||
[SerializeField] protected bool m_DataFromJson;
|
[SerializeField] protected bool m_DataFromJson;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if(ReferenceEquals(null, obj))
|
if (ReferenceEquals(null, obj))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ namespace XCharts
|
|||||||
public bool IsActive(string name)
|
public bool IsActive(string name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name)) return true;
|
if (string.IsNullOrEmpty(name)) return true;
|
||||||
for(int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
if (data[i].Equals(name)) return m_DataActiveList[i];
|
if (data[i].Equals(name)) return m_DataActiveList[i];
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ namespace XCharts
|
|||||||
btn.GetComponentInChildren<Text>().text = data[index];
|
btn.GetComponentInChildren<Text>().text = data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateButtonColor(int index,Color ableColor,Color unableColor)
|
public void UpdateButtonColor(int index, Color ableColor, Color unableColor)
|
||||||
{
|
{
|
||||||
if (IsActive(index))
|
if (IsActive(index))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
@@ -94,7 +93,7 @@ namespace XCharts
|
|||||||
m_Data.Add(value);
|
m_Data.Add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetData(int index,DataZoom dataZoom = null)
|
public float GetData(int index, DataZoom dataZoom = null)
|
||||||
{
|
{
|
||||||
var showData = GetData(dataZoom);
|
var showData = GetData(dataZoom);
|
||||||
if (index >= 0 && index <= showData.Count - 1)
|
if (index >= 0 && index <= showData.Count - 1)
|
||||||
@@ -133,7 +132,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
filterStart = startIndex;
|
filterStart = startIndex;
|
||||||
filterEnd = endIndex;
|
filterEnd = endIndex;
|
||||||
if(m_Data.Count > 0)
|
if (m_Data.Count > 0)
|
||||||
{
|
{
|
||||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||||
filterData = m_Data.GetRange(startIndex, count);
|
filterData = m_Data.GetRange(startIndex, count);
|
||||||
|
|||||||
@@ -211,10 +211,10 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (IsActive(i))
|
if (IsActive(i))
|
||||||
{
|
{
|
||||||
if(dataZoom != null && dataZoom.show)
|
if (dataZoom != null && dataZoom.show)
|
||||||
{
|
{
|
||||||
var showData = m_Series[i].GetData(dataZoom);
|
var showData = m_Series[i].GetData(dataZoom);
|
||||||
foreach(var data in showData)
|
foreach (var data in showData)
|
||||||
{
|
{
|
||||||
if (data > max) max = data;
|
if (data > max) max = data;
|
||||||
if (data < min) min = data;
|
if (data < min) min = data;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Title: IPropertyChanged,IEquatable<Title>
|
public class Title : IPropertyChanged, IEquatable<Title>
|
||||||
{
|
{
|
||||||
[SerializeField] private bool m_Show;
|
[SerializeField] private bool m_Show;
|
||||||
[SerializeField] private string m_Text;
|
[SerializeField] private string m_Text;
|
||||||
@@ -17,7 +16,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||||
public string text { get { return m_Text; } set { m_Text = value; } }
|
public string text { get { return m_Text; } set { m_Text = value; } }
|
||||||
public int textFontSize { get { return m_TextFontSize; }set { m_TextFontSize = value; } }
|
public int textFontSize { get { return m_TextFontSize; } set { m_TextFontSize = value; } }
|
||||||
public string subText { get { return m_SubText; } set { m_Text = value; } }
|
public string subText { get { return m_SubText; } set { m_Text = value; } }
|
||||||
public int subTextFontSize { get { return m_SubTextFontSize; } set { m_SubTextFontSize = value; } }
|
public int subTextFontSize { get { return m_SubTextFontSize; } set { m_SubTextFontSize = value; } }
|
||||||
public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } }
|
public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } }
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace XCharts
|
|||||||
[NonSerialized] private RectTransform m_LabelRectX;
|
[NonSerialized] private RectTransform m_LabelRectX;
|
||||||
[NonSerialized] private RectTransform m_LabelRectY;
|
[NonSerialized] private RectTransform m_LabelRectY;
|
||||||
|
|
||||||
public bool show { get { return m_Show; }set { m_Show = value; SetActive(value); } }
|
public bool show { get { return m_Show; } set { m_Show = value; SetActive(value); } }
|
||||||
public bool crossLabel { get { return m_CrossLabel; } set { m_CrossLabel = value; } }
|
public bool crossLabel { get { return m_CrossLabel; } set { m_CrossLabel = value; } }
|
||||||
|
|
||||||
public int dataIndex { get; set; }
|
public int dataIndex { get; set; }
|
||||||
@@ -47,6 +47,7 @@ namespace XCharts
|
|||||||
public void SetObj(GameObject obj)
|
public void SetObj(GameObject obj)
|
||||||
{
|
{
|
||||||
m_GameObject = obj;
|
m_GameObject = obj;
|
||||||
|
m_GameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetContentObj(GameObject content)
|
public void SetContentObj(GameObject content)
|
||||||
@@ -56,7 +57,7 @@ namespace XCharts
|
|||||||
m_ContentText = m_Content.GetComponentInChildren<Text>();
|
m_ContentText = m_Content.GetComponentInChildren<Text>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLabelObj(GameObject labelX,GameObject labelY)
|
public void SetLabelObj(GameObject labelX, GameObject labelY)
|
||||||
{
|
{
|
||||||
m_LabelX = labelX;
|
m_LabelX = labelX;
|
||||||
m_LabelRectX = labelX.GetComponent<RectTransform>();
|
m_LabelRectX = labelX.GetComponent<RectTransform>();
|
||||||
@@ -64,6 +65,8 @@ namespace XCharts
|
|||||||
m_LabelY = labelY;
|
m_LabelY = labelY;
|
||||||
m_LabelRectY = labelY.GetComponent<RectTransform>();
|
m_LabelRectY = labelY.GetComponent<RectTransform>();
|
||||||
m_LabelTextY = labelY.GetComponentInChildren<Text>();
|
m_LabelTextY = labelY.GetComponentInChildren<Text>();
|
||||||
|
m_LabelX.SetActive(false);
|
||||||
|
m_LabelY.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetContentBackgroundColor(Color color)
|
public void SetContentBackgroundColor(Color color)
|
||||||
@@ -96,17 +99,17 @@ namespace XCharts
|
|||||||
if (m_ContentText)
|
if (m_ContentText)
|
||||||
{
|
{
|
||||||
m_ContentText.text = txt;
|
m_ContentText.text = txt;
|
||||||
m_ContentRect.sizeDelta = new Vector2(m_ContentText.preferredWidth + 8,
|
m_ContentRect.sizeDelta = new Vector2(m_ContentText.preferredWidth + 8,
|
||||||
m_ContentText.preferredHeight + 8);
|
m_ContentText.preferredHeight + 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLabelText(string labelX,string labelY)
|
public void UpdateLabelText(string labelX, string labelY)
|
||||||
{
|
{
|
||||||
if (m_LabelTextX)
|
if (m_LabelTextX)
|
||||||
{
|
{
|
||||||
m_LabelTextX.text = labelX;
|
m_LabelTextX.text = labelX;
|
||||||
m_LabelRectX.sizeDelta = new Vector2(m_LabelTextX.preferredWidth + 8,
|
m_LabelRectX.sizeDelta = new Vector2(m_LabelTextX.preferredWidth + 8,
|
||||||
m_LabelTextX.preferredHeight + 8);
|
m_LabelTextX.preferredHeight + 8);
|
||||||
}
|
}
|
||||||
if (m_LabelTextY)
|
if (m_LabelTextY)
|
||||||
@@ -132,11 +135,11 @@ namespace XCharts
|
|||||||
|
|
||||||
public void UpdateContentPos(Vector2 pos)
|
public void UpdateContentPos(Vector2 pos)
|
||||||
{
|
{
|
||||||
if(m_Content)
|
if (m_Content)
|
||||||
m_Content.transform.localPosition = pos;
|
m_Content.transform.localPosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLabelPos(Vector2 xLabelPos,Vector2 yLabelPos)
|
public void UpdateLabelPos(Vector2 xLabelPos, Vector2 yLabelPos)
|
||||||
{
|
{
|
||||||
if (m_LabelX)
|
if (m_LabelX)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ namespace XCharts
|
|||||||
public override void AddData(string legend, float value)
|
public override void AddData(string legend, float value)
|
||||||
{
|
{
|
||||||
m_Legend.AddData(legend);
|
m_Legend.AddData(legend);
|
||||||
var serie = m_Series.AddData(legend,value);
|
var serie = m_Series.AddData(legend, value);
|
||||||
if (serie != null)
|
if (serie != null)
|
||||||
{
|
{
|
||||||
serie.ClearData();
|
serie.ClearData();
|
||||||
@@ -56,7 +55,7 @@ namespace XCharts
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var data = m_Series.series[i].data;
|
var data = m_Series.series[i].data;
|
||||||
if(data.Count <= 0)
|
if (data.Count <= 0)
|
||||||
{
|
{
|
||||||
m_AngleList.Add(0);
|
m_AngleList.Add(0);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user