Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一些textStyle.alignment设置似乎没有生效 #150

Closed
yu-xiaowen opened this issue May 24, 2021 · 1 comment
Closed

一些textStyle.alignment设置似乎没有生效 #150

yu-xiaowen opened this issue May 24, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@yu-xiaowen
Copy link

我使用的是 2.1.1版
`
using UnityEngine;
using XCharts;

public class TestAlignment : MonoBehaviour
{
public PieChart aPieChart;

void Start()
{
    initAPieChart();
}

void initAPieChart()
{
    aPieChart.ClearData();
    aPieChart.AddData(0, 105, "数据1");
    aPieChart.AddData(0, 132, "数据2");
    aPieChart.AddData(0, 116, "数据3");
    aPieChart.AddData(0, 94, "数据4");
    aPieChart.AddData(0, 121, "数据5");
    aPieChart.AddData(0, 52, "数据6");
    aPieChart.AddData(0, 189, "数据7");

    aPieChart.rectTransform.sizeDelta = new Vector2(1200, 800);

    aPieChart.series.GetSerie(0).label.show = true;
    aPieChart.series.GetSerie(0).label.line = true;
    aPieChart.series.GetSerie(0).label.lineLength1 = 50;
    aPieChart.series.GetSerie(0).label.textStyle.alignment = TextAnchor.MiddleLeft;
    aPieChart.series.GetSerie(0).label.formatter = "{b}{b}\n{c}";
    aPieChart.series.GetSerie(0).radius = new float[2] { 0f, 200f };
}

}
`

aPieChart.series.GetSerie(0).label.textStyle.alignment = TextAnchor.MiddleLeft;
这句设置了左对齐,文字分两行显示,但是依然是居中显示的。

另外设置柱状图的横轴标签文字的对齐方式也看不到效果:
aBarChart.xAxis0.axisLabel.textStyle.alignment = TextAnchor.MiddleRight;
这样设置后,我预期的是一段文字右侧和柱的中心线对齐,但是看到的仍然是一段文字中间和柱的中心线对齐。

谢谢作者开发的图表程序。

@monitor1394
Copy link
Collaborator

monitor1394 commented May 25, 2021

master已支持。Release要晚几天再发。
要用textStyle的设置的对齐需要设置autoAlign为false。

@monitor1394 monitor1394 added the bug Something isn't working label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants