diff --git a/Assets/XCharts/CHANGELOG-EN.md b/Assets/XCharts/CHANGELOG-EN.md
index ec8b825e..870d4f74 100644
--- a/Assets/XCharts/CHANGELOG-EN.md
+++ b/Assets/XCharts/CHANGELOG-EN.md
@@ -34,10 +34,11 @@
## master
+* (2021.05.25) Improved `TextStyle` support for `alignment`
* (2021.05.24) Fixed the problem that `Label` could not display properly when `PieChart` data were all `0`
* (2021.05.24) Fixed an issue where `Serie Name` was not working on the `Add Serie` panel (#149)
-* (2021.05.23) Added `TextStyle` `wrap` to set whether to wrap lines
-* (2021.05.23) Added` axisLabel `to` autoAlign `whether to set alignment automatically
+* (2021.05.23) Added `TextStyle` `autoWrap` to set whether to wrap lines
+* (2021.05.23) Added `TextStyle` `autoAlign` whether to set alignment automatically
* (2021.05.23) Added `width` and `height` of `axisLabel` to support custom text length and width
* (2021.05.23) Added `Axis` `iconStyle` and `icons` to support setting coordinate Axis labels to display icons
* (2021.05.20) Added the `insertDataHead` parameter to `Serie` and `Axis` to control whether data is inserted into the head or tail
diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md
index 5e1df578..ff95db89 100644
--- a/Assets/XCharts/CHANGELOG.md
+++ b/Assets/XCharts/CHANGELOG.md
@@ -34,10 +34,11 @@
## master
+* (2021.05.25) 完善`TextStyle`的`alignment`的支持 (#150)
* (2021.05.24) 修复`PieChart`数据全为`0`时`Label`无法正常显示的问题
* (2021.05.24) 修复`Add Serie`面板上`Serie Name`不生效的问题 (#149)
-* (2021.05.23) 增加`TextStyle`的`wrap`设置是否自动换行
-* (2021.05.23) 增加`AxisLabel`的`autoAlign`设置是否让系统自动设置对齐方式
+* (2021.05.23) 增加`TextStyle`的`autoWrap`设置是否自动换行
+* (2021.05.23) 增加`TextStyle`的`autoAlign`设置是否让系统自动设置对齐方式
* (2021.05.23) 增加`AxisLabel`的`width`和`height`支持自定义文本的长宽
* (2021.05.23) 增加`Axis`的`iconStyle`和`icons`支持设置坐标轴标签显示图标
* (2021.05.20) 增加`Serie`和`Axis`的`insertDataToHead`参数控制数据插入头部还是尾部
diff --git "a/Assets/XCharts/Documentation/XCharts\351\205\215\347\275\256\351\241\271\346\211\213\345\206\214.md" "b/Assets/XCharts/Documentation/XCharts\351\205\215\347\275\256\351\241\271\346\211\213\345\206\214.md"
index 67a663ee..37508bf9 100644
--- "a/Assets/XCharts/Documentation/XCharts\351\205\215\347\275\256\351\241\271\346\211\213\345\206\214.md"
+++ "b/Assets/XCharts/Documentation/XCharts\351\205\215\347\275\256\351\241\271\346\211\213\345\206\214.md"
@@ -205,7 +205,9 @@
* `fontSize`:字体大小。
* `fontStyle`:字体风格。
* `lineSpacing`:行间距。
-* `wrap`:是否自动换行。
+* `alignment`:对齐方式。
+* `autoWrap`:是否自动换行。
+* `autoAlign`:是否让系统自动设置对齐方式。为true时系统自动选择对齐方式,为false时用alignment。
## `Tooltip`
@@ -834,7 +836,6 @@ K线图系列。
* `onZero`:刻度标签显示在`0`刻度上。
* `width`:刻度标签的宽。当为0时系统自动设置。
* `height`:刻度标签的高。当为0时系统自动设置。
-* `autoAlign`:是否让系统自动设置对齐方式。为true时系统自动选择对齐方式,为false时用textStyle的对齐方式。
* `textLimit`:文本自适应 [TextLimit](#TextLimit)。只在类目轴中有效。
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
diff --git a/Assets/XCharts/Documentation/xcharts-configuration-EN.md b/Assets/XCharts/Documentation/xcharts-configuration-EN.md
index 3571669d..1d6db659 100644
--- a/Assets/XCharts/Documentation/xcharts-configuration-EN.md
+++ b/Assets/XCharts/Documentation/xcharts-configuration-EN.md
@@ -212,7 +212,8 @@ The component of settings related to text.
* `fontSize`: the size of text. [default: `18`].
* `fontStyle`: the font style of text. [default: `FontStyle.Normal`].
* `lineSpacing`: the space of text line. [default: `1f`].
-* `wrap`: Whether to wrap lines.
+* `autoWrap`: Whether to wrap lines.
+* `autoAlign`: Whether to let the system automatically set alignment. If true, the system automatically selects alignment, and if false, use alignment.
## `Tooltip`
@@ -728,7 +729,7 @@ K线图系列。
* `onZero`: 刻度标签显示在`0`刻度上。
* `width`:刻度标签的宽。当为0时系统自动设置。
* `height`:刻度标签的高。当为0时系统自动设置。
-* `autoAlign`:是否让系统自动设置对齐方式。为true时系统自动选择对齐方式,为false时用textStyle的对齐方式。
+
* `textLimit`: 文本自适应 [TextLimit](#TextLimit)。只在类目轴中有效。
* `textStyle`: The style of text [TextStyle](#TextStyle).
diff --git a/Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs b/Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs
index 0cf308ff..8760b656 100644
--- a/Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs
+++ b/Assets/XCharts/Editor/PropertyDrawers/AxisDrawer.cs
@@ -143,7 +143,6 @@ public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
- PropertyField(prop, "m_AutoAlign");
PropertyField(prop, "m_TextLimit");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
diff --git a/Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs b/Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs
index f9e9c34c..109073e4 100644
--- a/Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs
+++ b/Assets/XCharts/Editor/PropertyDrawers/SerieLabelDrawer.cs
@@ -5,7 +5,6 @@
/* */
/************************************************/
-using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
diff --git a/Assets/XCharts/Editor/PropertyDrawers/TextStyleDrawer.cs b/Assets/XCharts/Editor/PropertyDrawers/TextStyleDrawer.cs
index c909cfe8..acdec904 100644
--- a/Assets/XCharts/Editor/PropertyDrawers/TextStyleDrawer.cs
+++ b/Assets/XCharts/Editor/PropertyDrawers/TextStyleDrawer.cs
@@ -28,7 +28,6 @@ public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
#else
PropertyField(prop, "m_Font");
#endif
- PropertyField(prop, "m_Wrap");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Color");
@@ -41,6 +40,8 @@ public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
#else
PropertyField(prop, "m_FontStyle");
PropertyField(prop, "m_Alignment");
+ PropertyField(prop, "m_AutoWrap");
+ PropertyField(prop, "m_AutoAlign");
#endif
--EditorGUI.indentLevel;
}
diff --git a/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs b/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs
index 5aaabfc0..eee25c00 100644
--- a/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs
+++ b/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs
@@ -28,7 +28,6 @@ public class AxisLabel : SubComponent
[SerializeField] private bool m_OnZero = false;
[SerializeField] private float m_Width = 0f;
[SerializeField] private float m_Height = 0f;
- [SerializeField] private bool m_AutoAlign = true;
[SerializeField] private TextLimit m_TextLimit = new TextLimit();
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
@@ -125,14 +124,6 @@ public float height
get { return m_Height; }
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
}
- ///
- /// 文本是否自动选对齐方式。为false时会用TextStyle下的alignment。
- ///
- public bool autoAlign
- {
- get { return m_AutoAlign; }
- set { if (PropertyUtil.SetStruct(ref m_AutoAlign, value)) SetComponentDirty(); }
- }
///
/// 文本限制。
@@ -186,7 +177,6 @@ public AxisLabel Clone()
axisLabel.numericFormatter = numericFormatter;
axisLabel.width = width;
axisLabel.height = height;
- axisLabel.autoAlign = autoAlign;
axisLabel.textLimit = textLimit.Clone();
axisLabel.textStyle.Copy(textStyle);
return axisLabel;
@@ -202,7 +192,6 @@ public void Copy(AxisLabel axisLabel)
numericFormatter = axisLabel.numericFormatter;
width = axisLabel.width;
height = axisLabel.height;
- autoAlign = axisLabel.autoAlign;
textLimit.Copy(axisLabel.textLimit);
textStyle.Copy(axisLabel.textStyle);
}
diff --git a/Assets/XCharts/Runtime/Component/Sub/TextStyle.cs b/Assets/XCharts/Runtime/Component/Sub/TextStyle.cs
index 7f09c63d..6109a51a 100644
--- a/Assets/XCharts/Runtime/Component/Sub/TextStyle.cs
+++ b/Assets/XCharts/Runtime/Component/Sub/TextStyle.cs
@@ -21,8 +21,8 @@ namespace XCharts
public class TextStyle : SubComponent
{
[SerializeField] private Font m_Font;
-
- [SerializeField] private bool m_Wrap = true;
+ [SerializeField] private bool m_AutoWrap = true;
+ [SerializeField] private bool m_AutoAlign = true;
[SerializeField] private float m_Rotate = 0;
[SerializeField] private Vector2 m_Offset = Vector2.zero;
[SerializeField] private Color m_Color = Color.clear;
@@ -122,10 +122,18 @@ public float lineSpacing
///
/// 是否自动换行。
///
- public bool wrap
+ public bool autoWrap
+ {
+ get { return m_AutoWrap; }
+ set { if (PropertyUtil.SetStruct(ref m_AutoWrap, value)) SetComponentDirty(); }
+ }
+ ///
+ /// 文本是否让系统自动选对齐方式。为false时才会用alignment。
+ ///
+ public bool autoAlign
{
- get { return m_Wrap; }
- set { if (PropertyUtil.SetStruct(ref m_Wrap, value)) SetComponentDirty(); }
+ get { return m_AutoAlign; }
+ set { if (PropertyUtil.SetStruct(ref m_AutoAlign, value)) SetComponentDirty(); }
}
///
/// 对齐方式。
@@ -195,7 +203,8 @@ public void Copy(TextStyle textStyle)
fontStyle = textStyle.fontStyle;
lineSpacing = textStyle.lineSpacing;
alignment = textStyle.alignment;
- wrap = textStyle.wrap;
+ autoWrap = textStyle.autoWrap;
+ autoAlign = textStyle.autoAlign;
#if dUI_TextMeshPro
m_TMPFont = textStyle.tmpFont;
m_TMPAlignment = textStyle.tmpAlignment;
@@ -223,5 +232,10 @@ public int GetFontSize(ComponentTheme defaultTheme)
if (fontSize == 0) return defaultTheme.fontSize;
else return fontSize;
}
+
+ public TextAnchor GetAlignment(TextAnchor systemAlignment)
+ {
+ return m_AutoAlign ? systemAlignment : alignment;
+ }
}
}
\ No newline at end of file
diff --git a/Assets/XCharts/Runtime/Helper/LegendHelper.cs b/Assets/XCharts/Runtime/Helper/LegendHelper.cs
index 4b82f3f0..88779d85 100644
--- a/Assets/XCharts/Runtime/Helper/LegendHelper.cs
+++ b/Assets/XCharts/Runtime/Helper/LegendHelper.cs
@@ -57,7 +57,7 @@ public static LegendItem AddLegendItem(Legend legend, int i, string legendName,
ChartHelper.GetOrAddComponent(contentObj);
var txt = ChartHelper.AddTextObject("Text", contentObj.transform, anchorMin, anchorMax, pivot, sizeDelta,
textStyle, theme.legend);
- txt.SetAlignment(TextAnchor.MiddleLeft);
+ txt.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleLeft));
txt.SetColor(contentColor);
var item = new LegendItem();
item.index = i;
diff --git a/Assets/XCharts/Runtime/Internal/CoordinateChart.cs b/Assets/XCharts/Runtime/Internal/CoordinateChart.cs
index bef689f7..35261942 100644
--- a/Assets/XCharts/Runtime/Internal/CoordinateChart.cs
+++ b/Assets/XCharts/Runtime/Internal/CoordinateChart.cs
@@ -570,19 +570,13 @@ private void InitYAxis(int yAxisIndex, YAxis yAxis)
{
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
Vector2.zero, new Vector2(0, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis);
- if (yAxis.axisLabel.autoAlign)
- {
- txt.label.SetAlignment(TextAnchor.MiddleLeft);
- }
+ txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
}
else
{
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
Vector2.zero, new Vector2(1, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis);
- if (yAxis.axisLabel.autoAlign)
- {
- txt.label.SetAlignment(TextAnchor.MiddleRight);
- }
+ txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
}
var labelWidth = AxisHelper.GetScaleWidth(yAxis, grid.runtimeHeight, i + 1, dataZoom);
if (i == 0) yAxis.axisLabel.SetRelatedText(txt.label, labelWidth);
@@ -604,7 +598,7 @@ private void InitYAxis(int yAxisIndex, YAxis yAxis)
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
m_Theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleCenter);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(yAxis.position == Axis.AxisPosition.Right ?
new Vector2(grid.runtimeX + grid.runtimeWidth + offset.x + yAxis.offset, grid.runtimeY - offset.y) :
new Vector2(zeroPos.x + offset.x + yAxis.offset, grid.runtimeY - offset.y));
@@ -613,7 +607,7 @@ private void InitYAxis(int yAxisIndex, YAxis yAxis)
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(1, 0.5f),
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), axisNameTextStyle,
m_Theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleRight);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
axisName.SetLocalPosition(yAxis.position == Axis.AxisPosition.Right ?
new Vector2(grid.runtimeX + grid.runtimeWidth - offset.x + yAxis.offset, grid.runtimeY + grid.runtimeHeight / 2 + offset.y) :
new Vector2(grid.runtimeX - offset.x + yAxis.offset, grid.runtimeY + grid.runtimeHeight / 2 + offset.y));
@@ -622,7 +616,7 @@ private void InitYAxis(int yAxisIndex, YAxis yAxis)
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
m_Theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleCenter);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(yAxis.position == Axis.AxisPosition.Right ?
new Vector2(grid.runtimeX + grid.runtimeWidth + offset.x + yAxis.offset, grid.runtimeY + grid.runtimeHeight + offset.y) :
new Vector2(zeroPos.x + offset.x + yAxis.offset, grid.runtimeY + grid.runtimeHeight + offset.y));
@@ -697,10 +691,7 @@ private void InitXAxis(int xAxisIndex, XAxis xAxis)
new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 0.5f), new Vector2(textWidth, textHeight), xAxis, theme.axis);
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
- if (xAxis.axisLabel.autoAlign)
- {
- label.label.SetAlignment(TextAnchor.MiddleCenter);
- }
+ label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
label.SetPosition(GetLabelXPosition(totalWidth + textWidth / 2 + gapWidth, i, xAxisIndex, xAxis));
label.SetText(AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue, xAxis.runtimeMaxValue, dataZoom,
isPercentStack));
@@ -719,7 +710,7 @@ private void InitXAxis(int xAxisIndex, XAxis xAxis)
case AxisName.Location.Start:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(1, 0.5f),
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), axisNameTextStyle, theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleRight);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
axisName.SetLocalPosition(xAxis.position == Axis.AxisPosition.Top ?
new Vector2(zeroPos.x - offset.x, grid.runtimeY + grid.runtimeHeight + offset.y + xAxis.offset) :
new Vector2(zeroPos.x - offset.x, zeroPos.y + offset.y + xAxis.offset));
@@ -727,7 +718,7 @@ private void InitXAxis(int xAxisIndex, XAxis xAxis)
case AxisName.Location.Middle:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle, theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleCenter);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(xAxis.position == Axis.AxisPosition.Top ?
new Vector2(grid.runtimeX + grid.runtimeWidth / 2 + offset.x, grid.runtimeY + grid.runtimeHeight - offset.y + xAxis.offset) :
new Vector2(grid.runtimeX + grid.runtimeWidth / 2 + offset.x, grid.runtimeY - offset.y + xAxis.offset));
@@ -735,7 +726,7 @@ private void InitXAxis(int xAxisIndex, XAxis xAxis)
case AxisName.Location.End:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0, 0.5f),
new Vector2(0, 0.5f), new Vector2(0, 0.5f), new Vector2(100, 20), axisNameTextStyle, theme.axis);
- axisName.SetAlignment(TextAnchor.MiddleLeft);
+ axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleLeft));
axisName.SetLocalPosition(xAxis.position == Axis.AxisPosition.Top ?
new Vector2(grid.runtimeX + grid.runtimeWidth + offset.x, grid.runtimeY + grid.runtimeHeight + offset.y + xAxis.offset) :
new Vector2(grid.runtimeX + grid.runtimeWidth + offset.x, zeroPos.y + offset.y + xAxis.offset));
diff --git a/Assets/XCharts/Runtime/Internal/DrawSerieRadar.cs b/Assets/XCharts/Runtime/Internal/DrawSerieRadar.cs
index e522e933..7163ca3e 100644
--- a/Assets/XCharts/Runtime/Internal/DrawSerieRadar.cs
+++ b/Assets/XCharts/Runtime/Internal/DrawSerieRadar.cs
@@ -259,7 +259,7 @@ private void InitRadar(Radar radar)
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(txtWid, txtHig),
textStyle, chart.theme.radar);
txt.gameObject.hideFlags = chart.chartHideFlags;
- txt.SetAlignment(TextAnchor.MiddleCenter);
+ txt.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
txt.SetText(radar.indicatorList[i].name);
txt.SetActive(radar.indicator);
var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
diff --git a/Assets/XCharts/Runtime/Internal/Utility/ChartHelper.cs b/Assets/XCharts/Runtime/Internal/Utility/ChartHelper.cs
index 719cbf1d..e1e73104 100644
--- a/Assets/XCharts/Runtime/Internal/Utility/ChartHelper.cs
+++ b/Assets/XCharts/Runtime/Internal/Utility/ChartHelper.cs
@@ -253,7 +253,7 @@ public static ChartText AddTextObject(string name, Transform parent, Vector2 anc
chartText.text.font = textStyle.font == null ? theme.font : textStyle.font;
chartText.text.fontStyle = textStyle.fontStyle;
chartText.text.alignment = textStyle.alignment;
- chartText.text.horizontalOverflow = textStyle.wrap ? HorizontalWrapMode.Wrap : HorizontalWrapMode.Overflow;
+ chartText.text.horizontalOverflow = textStyle.autoWrap ? HorizontalWrapMode.Wrap : HorizontalWrapMode.Overflow;
chartText.text.verticalOverflow = VerticalWrapMode.Overflow;
chartText.text.supportRichText = true;
chartText.text.raycastTarget = false;
@@ -371,7 +371,7 @@ internal static GameObject AddTooltipContent(string name, Transform parent, Text
img.color = Color.black;
var txt = AddTextObject("Text", tooltipObj.transform, anchorMin, anchorMax, pivot, sizeDelta,
textStyle, theme.tooltip);
- txt.SetAlignment(TextAnchor.UpperLeft);
+ txt.SetAlignment(textStyle.GetAlignment(TextAnchor.UpperLeft));
txt.SetText("Text");
txt.SetLocalPosition(new Vector2(3, -3));
tooltipObj.transform.localPosition = Vector3.zero;
@@ -434,7 +434,7 @@ internal static GameObject AddSerieLabel(string name, Transform parent, float wi
var txt = AddTextObject("Text", labelObj.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle,
theme.common);
txt.SetColor(color);
- txt.SetAlignment(TextAnchor.MiddleCenter);
+ txt.SetAlignment(textStyle.alignment);
txt.SetText("Text");
txt.SetLocalPosition(new Vector2(0, 0));
txt.SetLocalEulerAngles(Vector3.zero);
diff --git a/Assets/XCharts/Runtime/PolarChart.cs b/Assets/XCharts/Runtime/PolarChart.cs
index 7914bf86..e3ef8beb 100644
--- a/Assets/XCharts/Runtime/PolarChart.cs
+++ b/Assets/XCharts/Runtime/PolarChart.cs
@@ -151,7 +151,7 @@ private void InitRadiusAxis(RadiusAxis axis)
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, SerieType.Bar);
var labelName = AxisHelper.GetLabelName(axis, radius, i, axis.runtimeMinValue, axis.runtimeMaxValue,
null, isPercentStack);
- label.label.SetAlignment(TextAnchor.MiddleCenter);
+ label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
label.SetText(labelName);
var pos = ChartHelper.GetPos(cenPos, totalWidth, startAngle, true) + tickVetor;
label.SetPosition(pos);
@@ -230,7 +230,7 @@ private void InitAngleAxis(AngleAxis axis)
var label = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(scaleAngle, txtHig), axis, theme.axis);
- label.label.SetAlignment(TextAnchor.MiddleCenter);
+ label.label.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
label.SetText(AxisHelper.GetLabelName(axis, total, i, axis.runtimeMinValue, axis.runtimeMaxValue,
null, isPercentStack));
var pos = ChartHelper.GetPos(cenPos, radius + margin,