diff --git a/Documentation~/en/api.md b/Documentation~/en/api.md index cd357de3..dd4ccd19 100644 --- a/Documentation~/en/api.md +++ b/Documentation~/en/api.md @@ -3303,7 +3303,7 @@ public static string CheckChart(BaseChart chart) ## ChildComponent -class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MarqueeStyle](#marqueestyle),[MLValue](#mlvalue),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle) +class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle) ### ChildComponent.anyDirty @@ -6411,6 +6411,8 @@ Configurations of select state. class in XCharts.Runtime / Inherits from: [BaseSerie](#baseserie),[IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=icomparable) / Subclasses: [SerieHandler<T>](#seriehandlert),[Bar](#bar),[SimplifiedBar](#simplifiedbar),[Candlestick](#candlestick),[SimplifiedCandlestick](#simplifiedcandlestick),[Heatmap](#heatmap),[Line](#line),[SimplifiedLine](#simplifiedline),[Parallel](#parallel),[Pie](#pie),[Radar](#radar),[Ring](#ring),[BaseScatter](#basescatter) +系列。系列一般由数据和配置组成,用来表示具体的图表图形,如折线图的一条折线,柱图的一组柱子等。一个图表中可以包含多个不同类型的系列。 + ### Serie.areaStyle public AreaStyle areaStyle @@ -8720,11 +8722,6 @@ public void SetActive(bool flag) public void SetContentActive(bool flag) 设置文本框是否显示 -### Tooltip.UpdateContentPos - -public void UpdateContentPos(Vector2 pos, float width, float height) -更新文本框位置 - ## Tooltip.Position class in XCharts.Runtime @@ -8802,7 +8799,7 @@ public static bool IsIgnoreFormatter(string itemFormatter) ### TooltipHelper.LimitInRect -public static void LimitInRect(Tooltip tooltip, Rect chartRect) +public static void LimitInRect(BaseChart chart, Tooltip tooltip, Rect chartRect) ## TooltipTheme @@ -8999,6 +8996,10 @@ public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons) public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check) +### UGLHelper.IsUp + +public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3) + ### UGLHelper.IsValueEqualsColor public static bool IsValueEqualsColor(Color color1, Color color2) diff --git a/Documentation~/en/configuration.md b/Documentation~/en/configuration.md index 789f7e0f..80e49047 100644 --- a/Documentation~/en/configuration.md +++ b/Documentation~/en/configuration.md @@ -1235,7 +1235,7 @@ class in XCharts.Runtime ## ChildComponent -class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MarqueeStyle](#marqueestyle), [MLValue](#mlvalue), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle) +class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle) ## Comment @@ -3399,6 +3399,8 @@ Configurations of select state. class in XCharts.Runtime / Inherits from: [BaseSerie](#baseserie), [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / Subclasses: [SerieHandler<T>](#seriehandlert), [Bar](#bar), [SimplifiedBar](#simplifiedbar), [Candlestick](#candlestick), [SimplifiedCandlestick](#simplifiedcandlestick), [Heatmap](#heatmap), [Line](#line), [SimplifiedLine](#simplifiedline), [Parallel](#parallel), [Pie](#pie), [Radar](#radar), [Ring](#ring), [BaseScatter](#basescatter) +系列。系列一般由数据和配置组成,用来表示具体的图表图形,如折线图的一条折线,柱图的一组柱子等。一个图表中可以包含多个不同类型的系列。 + ### Serie.align [Align](#align) diff --git a/Documentation~/zh/api.md b/Documentation~/zh/api.md index 1f0e6018..5a7d7425 100644 --- a/Documentation~/zh/api.md +++ b/Documentation~/zh/api.md @@ -3303,7 +3303,7 @@ public static string CheckChart(BaseChart chart) ## ChildComponent -class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MarqueeStyle](#marqueestyle),[MLValue](#mlvalue),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle) +class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle) ### ChildComponent.anyDirty @@ -6411,6 +6411,8 @@ class in XCharts.Runtime / 继承自: [StateStyle](#statestyle),[ISerieComponent class in XCharts.Runtime / 继承自: [BaseSerie](#baseserie),[IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=icomparable) / 子类: [SerieHandler<T>](#seriehandlert),[Bar](#bar),[SimplifiedBar](#simplifiedbar),[Candlestick](#candlestick),[SimplifiedCandlestick](#simplifiedcandlestick),[Heatmap](#heatmap),[Line](#line),[SimplifiedLine](#simplifiedline),[Parallel](#parallel),[Pie](#pie),[Radar](#radar),[Ring](#ring),[BaseScatter](#basescatter) +系列。系列一般由数据和配置组成,用来表示具体的图表图形,如折线图的一条折线,柱图的一组柱子等。一个图表中可以包含多个不同类型的系列。 + ### Serie.areaStyle public AreaStyle areaStyle @@ -8720,11 +8722,6 @@ public void SetActive(bool flag) public void SetContentActive(bool flag) 设置文本框是否显示 -### Tooltip.UpdateContentPos - -public void UpdateContentPos(Vector2 pos, float width, float height) -更新文本框位置 - ## Tooltip.Position class in XCharts.Runtime @@ -8802,7 +8799,7 @@ public static bool IsIgnoreFormatter(string itemFormatter) ### TooltipHelper.LimitInRect -public static void LimitInRect(Tooltip tooltip, Rect chartRect) +public static void LimitInRect(BaseChart chart, Tooltip tooltip, Rect chartRect) ## TooltipTheme @@ -8999,6 +8996,10 @@ public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons) public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check) +### UGLHelper.IsUp + +public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3) + ### UGLHelper.IsValueEqualsColor public static bool IsValueEqualsColor(Color color1, Color color2) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 2c351b92..37bebb7c 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -77,6 +77,7 @@ slug: /changelog ## master +* (2024.11.30) 修复`Tooltip`在图表设置其他锚点时手机上显示位置异常的问题 * (2024.11.27) 修复`Unity6`的一些代码警告问题 * (2024.11.26) 修复`Tooltip`在特殊情况下可能会超出屏幕显示不完整的问题 * (2024.11.24) 修复`UITable`在拖拽时也会点选的问题 diff --git a/Documentation~/zh/configuration.md b/Documentation~/zh/configuration.md index df8f1d9a..9514a70b 100644 --- a/Documentation~/zh/configuration.md +++ b/Documentation~/zh/configuration.md @@ -1235,7 +1235,7 @@ class in XCharts.Runtime ## ChildComponent -class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MarqueeStyle](#marqueestyle), [MLValue](#mlvalue), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle) +class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle) ## Comment @@ -3399,6 +3399,8 @@ class in XCharts.Runtime / 继承自: [StateStyle](#statestyle), [ISerieComponen class in XCharts.Runtime / 继承自: [BaseSerie](#baseserie), [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / 子类: [SerieHandler<T>](#seriehandlert), [Bar](#bar), [SimplifiedBar](#simplifiedbar), [Candlestick](#candlestick), [SimplifiedCandlestick](#simplifiedcandlestick), [Heatmap](#heatmap), [Line](#line), [SimplifiedLine](#simplifiedline), [Parallel](#parallel), [Pie](#pie), [Radar](#radar), [Ring](#ring), [BaseScatter](#basescatter) +系列。系列一般由数据和配置组成,用来表示具体的图表图形,如折线图的一条折线,柱图的一组柱子等。一个图表中可以包含多个不同类型的系列。 + ### Serie.align [Align](#align) diff --git a/Runtime/Component/Tooltip/Tooltip.cs b/Runtime/Component/Tooltip/Tooltip.cs index 68e797a9..593784c6 100644 --- a/Runtime/Component/Tooltip/Tooltip.cs +++ b/Runtime/Component/Tooltip/Tooltip.cs @@ -549,37 +549,6 @@ namespace XCharts.Runtime SetContentActive(flag); } - /// - /// 更新文本框位置 - /// - /// - public void UpdateContentPos(Vector2 pos, float width, float height) - { - if (view != null) - { - switch (m_Position) - { - case Position.Auto: -#if UNITY_ANDROID || UNITY_IOS - if (m_FixedY == 0) pos.y = ChartHelper.GetActualValue(0.7f, height); - else pos.y = ChartHelper.GetActualValue(m_FixedY, height); -#endif - break; - case Position.Custom: - pos.x = ChartHelper.GetActualValue(m_FixedX, width); - pos.y = ChartHelper.GetActualValue(m_FixedY, height); - break; - case Position.FixedX: - pos.x = ChartHelper.GetActualValue(m_FixedX, width); - break; - case Position.FixedY: - pos.y = ChartHelper.GetActualValue(m_FixedY, height); - break; - } - view.UpdatePosition(pos); - } - } - /// /// 设置文本框是否显示 /// diff --git a/Runtime/Component/Tooltip/TooltipHelper.cs b/Runtime/Component/Tooltip/TooltipHelper.cs index ffefaffc..777f9ace 100644 --- a/Runtime/Component/Tooltip/TooltipHelper.cs +++ b/Runtime/Component/Tooltip/TooltipHelper.cs @@ -90,7 +90,44 @@ namespace XCharts.Runtime if (screenPos.y > Screen.height - screenGap) pos.y -= Mathf.Abs(screenPos.y - Screen.height) + screenGap; - tooltip.UpdateContentPos(pos, chartRect.width / 2, chartRect.height / 2); + Debug.Log("rect: " + chartRect); + UpdateContentPos(tooltip, pos, chartRect); + } + + /// + /// 更新文本框位置 + /// + /// + private static void UpdateContentPos(Tooltip tooltip, Vector2 pos, Rect chartRect) + { + if (tooltip.view != null) + { + var width = chartRect.width; + var height = chartRect.height; + switch (tooltip.position) + { + case Tooltip.Position.Auto: +#if UNITY_ANDROID || UNITY_IOS + if (tooltip.fixedY == 0) pos.y = chartRect.x + ChartHelper.GetActualValue(0.7f, height); + else pos.y = chartRect.y + ChartHelper.GetActualValue(tooltip.fixedY, height); +#endif + break; + case Tooltip.Position.Custom: + pos = new Vector2(chartRect.x, chartRect.y); + pos.x += ChartHelper.GetActualValue(tooltip.fixedX, width); + pos.y += ChartHelper.GetActualValue(tooltip.fixedY, height); + break; + case Tooltip.Position.FixedX: + pos = new Vector2(chartRect.x, pos.y); + pos.x += ChartHelper.GetActualValue(tooltip.fixedX, width); + break; + case Tooltip.Position.FixedY: + pos = new Vector2(pos.x, chartRect.y); + pos.y += ChartHelper.GetActualValue(tooltip.fixedY, height); + break; + } + tooltip.view.UpdatePosition(pos); + } } public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)