diff --git a/Scripts/UI/Internal/BaseChart.cs b/Scripts/UI/Internal/BaseChart.cs index 60829348..0810d957 100644 --- a/Scripts/UI/Internal/BaseChart.cs +++ b/Scripts/UI/Internal/BaseChart.cs @@ -6,6 +6,12 @@ using UnityEngine.EventSystems; namespace XCharts { + public enum Orient + { + Horizonal, + Vertical + } + public class BaseChart : MaskableGraphic { private static readonly string s_TitleObjectName = "title"; @@ -331,12 +337,14 @@ namespace XCharts Input.mousePosition, null, out local)) { m_Tooltip.SetActive(false); + RefreshChart(); return; } if (local.x < 0 || local.x > chartWidth || local.y < 0 || local.y > chartHeight) { m_Tooltip.SetActive(false); + RefreshChart(); return; } m_Tooltip.pointerPos = local; diff --git a/Scripts/UI/Internal/CoordinateChart.cs b/Scripts/UI/Internal/CoordinateChart.cs index 43d8fb67..6988be91 100644 --- a/Scripts/UI/Internal/CoordinateChart.cs +++ b/Scripts/UI/Internal/CoordinateChart.cs @@ -70,8 +70,8 @@ namespace XCharts protected override void CheckTootipArea(Vector2 local) { - if (local.x < zeroX || local.x > zeroX + coordinateWid || - local.y < zeroY || local.y > zeroY + coordinateHig) + if (local.x < coordinateX || local.x > coordinateX + coordinateWid || + local.y < coordinateY || local.y > coordinateY + coordinateHig) { m_Tooltip.dataIndex = 0; RefreshTooltip(); diff --git a/Scripts/UI/Internal/Legend.cs b/Scripts/UI/Internal/Legend.cs index 168f4bbd..64557d40 100644 --- a/Scripts/UI/Internal/Legend.cs +++ b/Scripts/UI/Internal/Legend.cs @@ -8,12 +8,6 @@ namespace XCharts [System.Serializable] public class Legend : JsonDataSupport, IPropertyChanged, IEquatable { - public enum Orient - { - Horizonal, - Vertical - } - [SerializeField] private bool m_Show = true; [SerializeField] private Orient m_Orient = Orient.Horizonal; [SerializeField] private Location m_Location = Location.defaultRight; diff --git a/Scripts/UI/Internal/Tooltip.cs b/Scripts/UI/Internal/Tooltip.cs index 78cbcbfb..b5dea368 100644 --- a/Scripts/UI/Internal/Tooltip.cs +++ b/Scripts/UI/Internal/Tooltip.cs @@ -119,7 +119,8 @@ namespace XCharts public void SetActive(bool flag) { - if(m_GameObject && m_GameObject.activeInHierarchy != flag) + lastDataIndex = 0; + if (m_GameObject && m_GameObject.activeInHierarchy != flag) m_GameObject.SetActive(flag); }