Razor Chart Helper:如何更改AxisX文本方向 [英] Razor Chart Helper: How to change AxisX text orientation

查看:78
本文介绍了Razor Chart Helper:如何更改AxisX文本方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在视图中,我无法更改X轴
的标签文本的方向,我试图在主题中添加属性,但这似乎不起作用。
您有一个可行的主意吗?

In a view, I can not change the orientation of the text of the labels of the X axis I tried to add a property in a theme but this does not seem to work. Do you have an idea for it to work?

@{

    string myTheme = "<Chart>\r\n <ChartAreas>\r\n <ChartArea Name=\"Default\" _Template_=\"All\">\r\n <AxisX  TextOrientation=\"Rotated90\" Interval=\"1\" />\r\n  </ChartArea>\r\n </ChartAreas>\r\n \r\n \r\n</Chart>";


    var myChart = new Chart(width: 600, height: 400, theme: myTheme)
        .AddSeries(
            name: "test ",
            xValue: new[] { "Peter", "andrew" },
            yValues: new[] { "1", "2" })
             .AddLegend()
        .Write();

}

推荐答案

尝试一下:

@{
    string myTheme = "<Chart>\r\n <ChartAreas>\r\n <ChartArea Name=\"Default\" _Template_=\"All\">\r\n <AxisX IsLabelAutoFit=\"false\"><LabelStyle Angle=\"-90\" Interval=\"1\"></LabelStyle></AxisX>\r\n  </ChartArea>\r\n </ChartAreas>\r\n \r\n \r\n</Chart>";


    var myChart = new Chart(width: 600, height: 400, theme: myTheme)
        .AddSeries(
            name: "test ",
            xValue: new[] { "Peter", "andrew" },
            yValues: new[] { "1", "2" })
             .AddLegend()
        .Write();
}

这篇关于Razor Chart Helper:如何更改AxisX文本方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆