Skip to content

Commit

Permalink
Improved Axis's AxisLabel text rotate setting to avoid inconsiste…
Browse files Browse the repository at this point in the history
…ncy offset in `DataZoom` (#163)
  • Loading branch information
monitor1394 committed Aug 15, 2021
1 parent 34b0a97 commit 3949018
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Assets/XCharts/CHANGELOG-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Assets/XCharts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Assets/XCharts/Runtime/Internal/CoordinateChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,12 @@ private void InitXAxis(int xAxisIndex, XAxis xAxis)
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;
}
Expand Down

0 comments on commit 3949018

Please sign in to comment.