diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 8795461a..6e0cadff 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -81,6 +81,7 @@ slug: /changelog ## master +* (2026.06.03) 增加`Tooltip`通过`TitleLabelStyle`的`TextStyle`的`Alignment`设置标题的对齐方式 (#363) * (2026.05.25) 增加`DataZoom`的`filterAxisRange`设置坐标轴的范围计算是否受`DataZoom`的影响 * (2026.05.23) 优化`DataZoom`的`Marquee`框选功能 * (2026.05.23) 修复`DataZoom`内绘制的折线图可能会超出范围的问题 diff --git a/Runtime/Component/Tooltip/Tooltip.cs b/Runtime/Component/Tooltip/Tooltip.cs index e17247b7..c1cb9428 100644 --- a/Runtime/Component/Tooltip/Tooltip.cs +++ b/Runtime/Component/Tooltip/Tooltip.cs @@ -155,7 +155,7 @@ namespace XCharts.Runtime [SerializeField] private List m_ContentLabelStyles = new List() { - new LabelStyle() { textPadding = new TextPadding(0, 5, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleCenter } }, + new LabelStyle() { textPadding = new TextPadding(0, 5, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleLeft } }, new LabelStyle() { textPadding = new TextPadding(0, 20, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleLeft } }, new LabelStyle() { textPadding = new TextPadding(0, 0, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleRight } } }; diff --git a/Runtime/Component/Tooltip/TooltipView.cs b/Runtime/Component/Tooltip/TooltipView.cs index 0ae78702..294f3691 100644 --- a/Runtime/Component/Tooltip/TooltipView.cs +++ b/Runtime/Component/Tooltip/TooltipView.cs @@ -260,6 +260,7 @@ namespace XCharts.Runtime view.layout.childControlWidth = false; view.layout.childForceExpandHeight = false; view.layout.childForceExpandWidth = false; + view.layout.childAlignment = tooltip.titleLabelStyle.textStyle.alignment; view.layout.padding = new RectOffset(tooltip.paddingLeftRight, tooltip.paddingLeftRight, tooltip.paddingTopBottom,