From 8bc66ca30abd79321abf3ccaf5cb8760d3064756 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Fri, 21 Mar 2025 21:39:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Comment=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Component/Comment/CommentHander.cs | 6 +++--- Runtime/Serie/SerieHandler.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Runtime/Component/Comment/CommentHander.cs b/Runtime/Component/Comment/CommentHander.cs index 7520aa29..ca49cbaa 100644 --- a/Runtime/Component/Comment/CommentHander.cs +++ b/Runtime/Component/Comment/CommentHander.cs @@ -14,7 +14,7 @@ namespace XCharts.Runtime var comment = component; comment.OnChanged(); comment.painter = null; - comment.refreshComponent = delegate() + comment.refreshComponent = delegate () { var objName = ChartCached.GetComponentObjectName(comment); var commentObj = ChartHelper.AddObject(objName, @@ -31,12 +31,12 @@ namespace XCharts.Runtime { var item = comment.items[i]; var labelStyle = comment.GetLabelStyle(i); + item.location.OnChanged(); var labelPos = chart.chartPosition + item.location.GetPosition(chart.chartWidth, chart.chartHeight); var label = ChartHelper.AddChartLabel(s_CommentObjectName + i, commentObj.transform, labelStyle, chart.theme.common, GetContent(item), Color.clear, TextAnchor.MiddleCenter); label.SetActive(comment.show && item.show, true); - label.SetPosition(labelPos); - label.text.SetLocalPosition(labelStyle.offset); + label.SetPosition(labelPos + labelStyle.offset); item.labelObject = label; } }; diff --git a/Runtime/Serie/SerieHandler.cs b/Runtime/Serie/SerieHandler.cs index d7468ed2..b8ea2ec4 100644 --- a/Runtime/Serie/SerieHandler.cs +++ b/Runtime/Serie/SerieHandler.cs @@ -614,7 +614,7 @@ namespace XCharts.Runtime if (endLabelStyle == null) return; var dataCount = serie.context.dataPoints.Count; - var active = endLabelStyle.show && dataCount > 0; + var active = endLabelStyle.show && dataCount > 0 && !ChartHelper.IsZeroVector(serie.context.lineEndPostion); m_EndLabel.SetActive(active); if (active) {