diff --git a/Demo/Scripts/Demo_Dynamic.cs b/Demo/Scripts/Demo_Dynamic.cs index b5a1b9c2..ef10b0b0 100644 --- a/Demo/Scripts/Demo_Dynamic.cs +++ b/Demo/Scripts/Demo_Dynamic.cs @@ -1,6 +1,5 @@ using System; using UnityEngine; -using UnityEngine.UI; using XCharts; [DisallowMultipleComponent] diff --git a/Demo/Scripts/Demo_LargeData.cs b/Demo/Scripts/Demo_LargeData.cs index f71d8bff..87c7e149 100644 --- a/Demo/Scripts/Demo_LargeData.cs +++ b/Demo/Scripts/Demo_LargeData.cs @@ -26,10 +26,10 @@ public class Demo_LargeData : MonoBehaviour void Update() { - if (initCount< maxCacheDataNumber) + if (initCount < maxCacheDataNumber) { 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); chart.AddXAxisData(timeNow.ToString("hh:mm:ss")); diff --git a/Demo/Scripts/Demo_PieChart.cs b/Demo/Scripts/Demo_PieChart.cs index a5c5c6bd..5ac503db 100644 --- a/Demo/Scripts/Demo_PieChart.cs +++ b/Demo/Scripts/Demo_PieChart.cs @@ -19,10 +19,10 @@ public class Demo_PieChart : MonoBehaviour private void Update() { time += Time.deltaTime; - if(time > 1 ) + if (time > 1) { time = 0; - if(count < 5) + if (count < 5) { chart.AddData("time" + count, Random.Range(10, 100)); } diff --git a/Demo/Scripts/Demo_Test.cs b/Demo/Scripts/Demo_Test.cs index 8230266f..cf8b79a6 100644 --- a/Demo/Scripts/Demo_Test.cs +++ b/Demo/Scripts/Demo_Test.cs @@ -1,5 +1,4 @@ using UnityEngine; -using UnityEngine.UI; using XCharts; [DisallowMultipleComponent] diff --git a/Scripts/Editor/BaseChartEditor.cs b/Scripts/Editor/BaseChartEditor.cs index c38098c6..c14f7da1 100644 --- a/Scripts/Editor/BaseChartEditor.cs +++ b/Scripts/Editor/BaseChartEditor.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using UnityEditor; +using UnityEditor; using UnityEngine; namespace XCharts @@ -33,8 +32,8 @@ namespace XCharts private bool m_ThemeModuleToggle = false; private bool m_BaseModuleToggle = false; - - + + protected virtual void OnEnable() { @@ -75,7 +74,7 @@ namespace XCharts { EditorGUILayout.PropertyField(m_Script); EditorGUILayout.BeginHorizontal(); - EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth -5; + EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth - 5; m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme", ChartEditorHelper.foldoutStyle); EditorGUILayout.PropertyField(m_Theme, GUIContent.none); @@ -93,7 +92,7 @@ namespace XCharts protected virtual void OnMiddleInspectorGUI() { - EditorGUILayout.PropertyField(m_Series,true); + EditorGUILayout.PropertyField(m_Series, true); m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle, "Base", ChartEditorHelper.foldoutStyle); if (m_BaseModuleToggle) diff --git a/Scripts/Editor/PropertyDrawers/AxisDrawer.cs b/Scripts/Editor/PropertyDrawers/AxisDrawer.cs index 31db6fa6..27d2b82a 100644 --- a/Scripts/Editor/PropertyDrawers/AxisDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/AxisDrawer.cs @@ -1,7 +1,6 @@ using UnityEditor; using UnityEditorInternal; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -107,7 +106,7 @@ namespace XCharts EditorGUI.PropertyField(drawRect, m_AxisTick); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick); - + if (type == Axis.AxisType.Category) { drawRect.width = EditorGUIUtility.labelWidth + 10; @@ -154,11 +153,12 @@ namespace XCharts { height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing; } - }else if(type == Axis.AxisType.Value) + } + else if (type == Axis.AxisType.Value) { height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; 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; } @@ -166,7 +166,7 @@ namespace XCharts height += EditorGUI.GetPropertyHeight(m_AxisTick); return height; } - + } } } \ No newline at end of file diff --git a/Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs b/Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs index 90b9a9a9..607a379c 100644 --- a/Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/AxisTickDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/BarDrawer.cs b/Scripts/Editor/PropertyDrawers/BarDrawer.cs index 3ea53bbd..ad3fb1d6 100644 --- a/Scripts/Editor/PropertyDrawers/BarDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/BarDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs b/Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs index d3861649..b57f8b74 100644 --- a/Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/CoordinateDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -22,7 +21,7 @@ namespace XCharts SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize"); 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; if (m_CoordinateModuleToggle) { diff --git a/Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs b/Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs index 4852d3ea..123d3c98 100644 --- a/Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/DataZoomDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/LegendDrawer.cs b/Scripts/Editor/PropertyDrawers/LegendDrawer.cs index 0c6e26e4..7b58a7ad 100644 --- a/Scripts/Editor/PropertyDrawers/LegendDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/LegendDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -63,7 +62,7 @@ namespace XCharts SerializedProperty location = prop.FindPropertyRelative("m_Location"); height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing; height += EditorGUI.GetPropertyHeight(location); - height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; + height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_DataFoldout) { SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); diff --git a/Scripts/Editor/PropertyDrawers/LineDrawer.cs b/Scripts/Editor/PropertyDrawers/LineDrawer.cs index 2cdd9efd..e05d690c 100644 --- a/Scripts/Editor/PropertyDrawers/LineDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/LineDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -49,7 +48,7 @@ namespace XCharts if (m_Point.boolValue) { drawRect.x = EditorGUIUtility.labelWidth + 15; - EditorGUI.LabelField(drawRect,"Width"); + EditorGUI.LabelField(drawRect, "Width"); drawRect.x = EditorGUIUtility.labelWidth + 65; float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70; if (tempWidth < 20) tempWidth = 20; diff --git a/Scripts/Editor/PropertyDrawers/LocationDrawer.cs b/Scripts/Editor/PropertyDrawers/LocationDrawer.cs index fce91a59..de38fd14 100644 --- a/Scripts/Editor/PropertyDrawers/LocationDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/LocationDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/PieDrawer.cs b/Scripts/Editor/PropertyDrawers/PieDrawer.cs index 40da048b..79aa8349 100644 --- a/Scripts/Editor/PropertyDrawers/PieDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/PieDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/RadarDrawer.cs b/Scripts/Editor/PropertyDrawers/RadarDrawer.cs index 927cb31f..300d949e 100644 --- a/Scripts/Editor/PropertyDrawers/RadarDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/RadarDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -63,13 +62,13 @@ namespace XCharts if (m_RadarModuleToggle) { ++EditorGUI.indentLevel; - + EditorGUIUtility.fieldWidth = 10; - + EditorGUIUtility.labelWidth = 50; drawRect.width = 60; EditorGUI.PropertyField(drawRect, m_Cricle); - + EditorGUIUtility.labelWidth = 45; drawRect.x += 60; EditorGUI.PropertyField(drawRect, m_Area); @@ -129,7 +128,7 @@ namespace XCharts if (m_RadarModuleToggle) { propNum += 13; - + if (m_BackgroundColorToggle) { m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList"); @@ -139,14 +138,14 @@ namespace XCharts 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) { m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList"); 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)); } diff --git a/Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs b/Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs index 6591a33f..7f42160c 100644 --- a/Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/RadarIndicatorDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -31,12 +30,12 @@ namespace XCharts if (m_RadarModuleToggle) { ++EditorGUI.indentLevel; - + EditorGUI.PropertyField(drawRect, m_Name); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Max); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; - + --EditorGUI.indentLevel; } } @@ -47,7 +46,7 @@ namespace XCharts if (m_RadarModuleToggle) { propNum += 2; - return propNum * EditorGUIUtility.singleLineHeight + (propNum -1) * EditorGUIUtility.standardVerticalSpacing; + return propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing; } else { diff --git a/Scripts/Editor/PropertyDrawers/SerieDrawer.cs b/Scripts/Editor/PropertyDrawers/SerieDrawer.cs index bcff5341..b0fa5fef 100644 --- a/Scripts/Editor/PropertyDrawers/SerieDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/SerieDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/SeriesDrawer.cs b/Scripts/Editor/PropertyDrawers/SeriesDrawer.cs index 018fa1e1..f4ba4fee 100644 --- a/Scripts/Editor/PropertyDrawers/SeriesDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/SeriesDrawer.cs @@ -1,7 +1,5 @@ -using System.Collections.Generic; -using UnityEditor; +using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs b/Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs index e9db39b7..a6661ccb 100644 --- a/Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/ThemeInfoDrawer.cs @@ -1,7 +1,6 @@ using UnityEditor; using UnityEditorInternal; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/TitleDrawer.cs b/Scripts/Editor/PropertyDrawers/TitleDrawer.cs index 3d1da7e4..2c067ba9 100644 --- a/Scripts/Editor/PropertyDrawers/TitleDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/TitleDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/Editor/PropertyDrawers/TooltipDrawer.cs b/Scripts/Editor/PropertyDrawers/TooltipDrawer.cs index 1e2446ef..cf3b8798 100644 --- a/Scripts/Editor/PropertyDrawers/TooltipDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/TooltipDrawer.cs @@ -1,6 +1,5 @@ using UnityEditor; using UnityEngine; -using UnityEngine.UI; namespace XCharts { @@ -27,7 +26,7 @@ namespace XCharts public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) { - if(m_TooltipModuleToggle) + if (m_TooltipModuleToggle) return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); else return 1 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); diff --git a/Scripts/UI/Interface/IJsonData.cs b/Scripts/UI/Interface/IJsonData.cs index 1b8f0c4d..12767942 100644 --- a/Scripts/UI/Interface/IJsonData.cs +++ b/Scripts/UI/Interface/IJsonData.cs @@ -1,7 +1,4 @@ -using UnityEngine; -using System.Collections; - -namespace XCharts +namespace XCharts { public interface IJsonData { diff --git a/Scripts/UI/Interface/IPropertyChanged.cs b/Scripts/UI/Interface/IPropertyChanged.cs index 49e49e75..e4c6960f 100644 --- a/Scripts/UI/Interface/IPropertyChanged.cs +++ b/Scripts/UI/Interface/IPropertyChanged.cs @@ -1,7 +1,4 @@ -using UnityEngine; -using System.Collections; - -namespace XCharts +namespace XCharts { public interface IPropertyChanged { diff --git a/Scripts/UI/Internal/Axis.cs b/Scripts/UI/Internal/Axis.cs index f34636f7..2cd3f1c5 100644 --- a/Scripts/UI/Internal/Axis.cs +++ b/Scripts/UI/Internal/Axis.cs @@ -118,7 +118,7 @@ namespace XCharts m_Data.Add(category); } - public string GetData(int index,DataZoom dataZoom) + public string GetData(int index, DataZoom dataZoom) { var showData = GetData(dataZoom); if (index >= 0 && index < showData.Count) @@ -131,10 +131,10 @@ namespace XCharts { 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 count = endIndex == startIndex ? 1 : endIndex - startIndex + 1; - if(filterData == null || filterData.Count != count) + if (filterData == null || filterData.Count != count) { UpdateFilterData(dataZoom); } @@ -152,7 +152,7 @@ namespace XCharts { var startIndex = (int)((data.Count - 1) * dataZoom.start / 100); var endIndex = (int)((data.Count - 1) * dataZoom.end / 100); - if(startIndex != filterStart || endIndex != filterEnd) + if (startIndex != filterStart || endIndex != filterEnd) { filterStart = startIndex; filterEnd = endIndex; @@ -166,7 +166,7 @@ namespace XCharts filterData = m_Data; } } - else if(endIndex == 0) + else if (endIndex == 0) { filterData = new List(); } @@ -183,7 +183,7 @@ namespace XCharts 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); } @@ -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; if (num <= 0) num = 1; diff --git a/Scripts/UI/Internal/Coordinate.cs b/Scripts/UI/Internal/Coordinate.cs index b0f8b15f..22b50589 100644 --- a/Scripts/UI/Internal/Coordinate.cs +++ b/Scripts/UI/Internal/Coordinate.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; namespace XCharts { diff --git a/Scripts/UI/Internal/CoordinateChart.cs b/Scripts/UI/Internal/CoordinateChart.cs index dbb28605..9e98bcac 100644 --- a/Scripts/UI/Internal/CoordinateChart.cs +++ b/Scripts/UI/Internal/CoordinateChart.cs @@ -2,7 +2,6 @@ using UnityEngine.UI; using System.Collections.Generic; using System.Text; -using System; using UnityEngine.EventSystems; namespace XCharts @@ -162,7 +161,6 @@ namespace XCharts m_Tooltip.SetActive(false); return; } - m_Tooltip.SetActive(true); if (m_Series.Count == 1) { float value = m_Series.GetData(0, index); @@ -221,6 +219,7 @@ namespace XCharts pos.y = m_Tooltip.height; } m_Tooltip.UpdateContentPos(pos); + m_Tooltip.SetActive(true); } protected override void OnThemeChanged() diff --git a/Scripts/UI/Internal/DataZoom.cs b/Scripts/UI/Internal/DataZoom.cs index f938edfa..6aea0955 100644 --- a/Scripts/UI/Internal/DataZoom.cs +++ b/Scripts/UI/Internal/DataZoom.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; using UnityEngine.UI; namespace XCharts @@ -84,7 +82,7 @@ namespace XCharts rangeMode = RangeMode.Percent, start = 30, end = 70, - m_ScrollSensitivity=10, + m_ScrollSensitivity = 10, }; } } @@ -119,7 +117,7 @@ namespace XCharts public void SetLabelActive(bool flag) { - if(startLabel && startLabel.gameObject.activeInHierarchy!=flag) + if (startLabel && startLabel.gameObject.activeInHierarchy != flag) { startLabel.gameObject.SetActive(flag); } diff --git a/Scripts/UI/Internal/JsonDataSupport.cs b/Scripts/UI/Internal/JsonDataSupport.cs index dd45dcac..2a5d26d2 100644 --- a/Scripts/UI/Internal/JsonDataSupport.cs +++ b/Scripts/UI/Internal/JsonDataSupport.cs @@ -3,7 +3,7 @@ using System; namespace XCharts { - public class JsonDataSupport: IJsonData,ISerializationCallbackReceiver + public class JsonDataSupport : IJsonData, ISerializationCallbackReceiver { [SerializeField] protected string m_JsonData; [SerializeField] protected bool m_DataFromJson; diff --git a/Scripts/UI/Internal/Legend.cs b/Scripts/UI/Internal/Legend.cs index ef3fce46..041e6ce8 100644 --- a/Scripts/UI/Internal/Legend.cs +++ b/Scripts/UI/Internal/Legend.cs @@ -72,7 +72,7 @@ namespace XCharts public override bool Equals(object obj) { - if(ReferenceEquals(null, obj)) + if (ReferenceEquals(null, obj)) { return false; } @@ -128,7 +128,7 @@ namespace XCharts public bool IsActive(string name) { 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]; } @@ -204,7 +204,7 @@ namespace XCharts btn.GetComponentInChildren().text = data[index]; } - public void UpdateButtonColor(int index,Color ableColor,Color unableColor) + public void UpdateButtonColor(int index, Color ableColor, Color unableColor) { if (IsActive(index)) { diff --git a/Scripts/UI/Internal/Serie.cs b/Scripts/UI/Internal/Serie.cs index 3254842d..2a1a81b3 100644 --- a/Scripts/UI/Internal/Serie.cs +++ b/Scripts/UI/Internal/Serie.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; namespace XCharts @@ -94,7 +93,7 @@ namespace XCharts m_Data.Add(value); } - public float GetData(int index,DataZoom dataZoom = null) + public float GetData(int index, DataZoom dataZoom = null) { var showData = GetData(dataZoom); if (index >= 0 && index <= showData.Count - 1) @@ -133,7 +132,7 @@ namespace XCharts { filterStart = startIndex; filterEnd = endIndex; - if(m_Data.Count > 0) + if (m_Data.Count > 0) { var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1; filterData = m_Data.GetRange(startIndex, count); diff --git a/Scripts/UI/Internal/Series.cs b/Scripts/UI/Internal/Series.cs index 0f186223..48e1e873 100644 --- a/Scripts/UI/Internal/Series.cs +++ b/Scripts/UI/Internal/Series.cs @@ -211,10 +211,10 @@ namespace XCharts { if (IsActive(i)) { - if(dataZoom != null && dataZoom.show) + if (dataZoom != null && dataZoom.show) { var showData = m_Series[i].GetData(dataZoom); - foreach(var data in showData) + foreach (var data in showData) { if (data > max) max = data; if (data < min) min = data; diff --git a/Scripts/UI/Internal/Title.cs b/Scripts/UI/Internal/Title.cs index e9e713f3..50e01c8b 100644 --- a/Scripts/UI/Internal/Title.cs +++ b/Scripts/UI/Internal/Title.cs @@ -1,11 +1,10 @@ using UnityEngine; -using System.Collections; using System; namespace XCharts { [Serializable] - public class Title: IPropertyChanged,IEquatable + public class Title : IPropertyChanged, IEquatable<Title> { [SerializeField] private bool m_Show; [SerializeField] private string m_Text; @@ -17,7 +16,7 @@ namespace XCharts public bool show { get { return m_Show; } set { m_Show = 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 int subTextFontSize { get { return m_SubTextFontSize; } set { m_SubTextFontSize = value; } } public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } } diff --git a/Scripts/UI/Internal/Tooltip.cs b/Scripts/UI/Internal/Tooltip.cs index b5dea368..75df258b 100644 --- a/Scripts/UI/Internal/Tooltip.cs +++ b/Scripts/UI/Internal/Tooltip.cs @@ -21,7 +21,7 @@ namespace XCharts [NonSerialized] private RectTransform m_LabelRectX; [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 int dataIndex { get; set; } @@ -47,6 +47,7 @@ namespace XCharts public void SetObj(GameObject obj) { m_GameObject = obj; + m_GameObject.SetActive(false); } public void SetContentObj(GameObject content) @@ -56,7 +57,7 @@ namespace XCharts m_ContentText = m_Content.GetComponentInChildren<Text>(); } - public void SetLabelObj(GameObject labelX,GameObject labelY) + public void SetLabelObj(GameObject labelX, GameObject labelY) { m_LabelX = labelX; m_LabelRectX = labelX.GetComponent<RectTransform>(); @@ -64,6 +65,8 @@ namespace XCharts m_LabelY = labelY; m_LabelRectY = labelY.GetComponent<RectTransform>(); m_LabelTextY = labelY.GetComponentInChildren<Text>(); + m_LabelX.SetActive(false); + m_LabelY.SetActive(false); } public void SetContentBackgroundColor(Color color) @@ -96,17 +99,17 @@ namespace XCharts if (m_ContentText) { 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); } } - public void UpdateLabelText(string labelX,string labelY) + public void UpdateLabelText(string labelX, string labelY) { if (m_LabelTextX) { 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); } if (m_LabelTextY) @@ -132,11 +135,11 @@ namespace XCharts public void UpdateContentPos(Vector2 pos) { - if(m_Content) + if (m_Content) m_Content.transform.localPosition = pos; } - public void UpdateLabelPos(Vector2 xLabelPos,Vector2 yLabelPos) + public void UpdateLabelPos(Vector2 xLabelPos, Vector2 yLabelPos) { if (m_LabelX) { diff --git a/Scripts/UI/PieChart.cs b/Scripts/UI/PieChart.cs index 254feacb..5e8277e9 100644 --- a/Scripts/UI/PieChart.cs +++ b/Scripts/UI/PieChart.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Text; using UnityEngine; using UnityEngine.UI; @@ -20,7 +19,7 @@ namespace XCharts public override void AddData(string legend, float value) { m_Legend.AddData(legend); - var serie = m_Series.AddData(legend,value); + var serie = m_Series.AddData(legend, value); if (serie != null) { serie.ClearData(); @@ -56,7 +55,7 @@ namespace XCharts continue; } var data = m_Series.series[i].data; - if(data.Count <= 0) + if (data.Count <= 0) { m_AngleList.Add(0); continue;