AxisLabel使用MsWeb图表堆积柱形图

时间:2012-09-12 04:41:59

标签: webchartcontrol

我正在使用Ms Web Chart来堆积柱形图。如果列数为< = 9,则Axis标签正常运行。如果它超过9,则标签不正确。

for(int pointIndex = 0; pointIndex < 10; pointIndex++)
{
    Chart1.Series["Series1"].Points.AddY(Math.Round((double)random.Next(45, 95),0));
    Chart1.Series["Series2"].Points.AddY(Math.Round((double)random.Next(5, 75),0));
    Chart1.Series["Series3"].Points.AddY(Math.Round((double)random.Next(5, 95), 0));
    Chart1.Series["Series4"].Points.AddY(Math.Round((double)random.Next(35, 95), 0));

    Chart1.Series["Series1"].Points[pointIndex].AxisLabel = "test" + pointIndex;  
}

Chart1.Series["Series1"].ChartType = "StackedColumn";
Chart1.Series["Series2"].ChartType = "StackedColumn";
Chart1.Series["Series3"].ChartType = "StackedColumn";
Chart1.Series["Series4"].ChartType = "StackedColumn";

如果点指数小于= 9,那么如果它是> 1则会变好。 9然后轴标签正确

1 个答案:

答案 0 :(得分:0)

<AxisX LineColor="64, 64, 64, 64"  Title="Instrument Type" IsLabelAutoFit="true" TitleFont="Microsoft Sans Serif, 15pt, style=Bold" LabelAutoFitStyle="LabelsAngleStep90" Interval="1" > <LabelStyle Font="Microsoft Sans Serif, 7pt, style=Bold" /> </AxisX>

将此LabelAutoFitStyle="LabelsAngleStep90" Interval="1"添加到您的轴信息中。你可以看到任意数量的标签