剃刀图助手:如何更改AxisX文本方向(Razor Chart Helper: How to cha

2019-09-28 16:05发布

在视图中,我不能改变我试图在一个主题添加属性X轴的标签的文本的方向,但是这似乎并没有工作。 你有一个想法,它的工作?

@{

    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();

}

Answer 1:

尝试这个:

@{
    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: How to change AxisX text orientation