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 a92e01d806
commit c9fa415776
3 changed files with 5 additions and 3 deletions

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;
}