Improved Axis's AxisLabel text rotate setting to avoid inconsistency offset in DataZoom (#163)

This commit is contained in:
monitor1394
2021-08-15 22:35:27 +08:00
parent 6fae151c8e
commit 3590d1ebbc
3 changed files with 5 additions and 3 deletions

View File

@@ -39,6 +39,7 @@
## master
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
* (2021.08.12) Optimize `BarChart` setting `Corner` when the positive and negative columns are fillet symmetric
* (2021.08.03) Fixed y axis not displaying when all data is 0

View File

@@ -39,7 +39,8 @@
## master
* (2021.08.14) 增加`Legend``textAutoColor`设置文本颜色和`Serie`一致
* (2021.08.15) 优化`Axis``AxisLabel`文本旋转设置避免在DataZoom开启时偏移不一致 (#163)
* (2021.08.14) 增加`Legend``textAutoColor`设置文本颜色和`Serie`一致 (#163)
* (2021.08.12) 优化`BarChart`设置`Corner`时正负柱条圆角对称
* (2021.08.03) 优化`Serie`的数据全为0时Y轴不显示的问题
* (2021.07.29) 修复`Serie`开启`ignore`时被忽略的数据还会参与计算的问题 (#161)

View File

@@ -728,12 +728,12 @@ namespace XCharts
var labelName = AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue,
xAxis.runtimeMaxValue, dataZoom, isPercentStack);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, ChartCached.GetXAxisName(xAxisIndex, i),
axisObj.transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 0.5f),
axisObj.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
new Vector2(textWidth, textHeight), xAxis, theme.axis, labelName);
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
label.SetPosition(GetLabelXPosition(totalWidth + textWidth / 2 + gapWidth, i, xAxisIndex, xAxis));
label.SetPosition(GetLabelXPosition(totalWidth + gapWidth, i, xAxisIndex, xAxis));
xAxis.runtimeAxisLabelList.Add(label);
totalWidth += labelWidth;
}