AxisLabel Stacked Column Chart using MsWeb Chart

337 Views Asked by At

I'm using Ms Web Chart to have stacked column chart. The Axis Label are coming properly if the no of columns are <= 9. if it is more than 9 then the lables are not coming properly.

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

if the pointindex is less than = 9 then it is coming fine if it is > 9 then the axis labels are coming properly

1

There are 1 best solutions below

0
jabeen On
<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>

Add this LabelAutoFitStyle="LabelsAngleStep90" Interval="1" to your axis info . you can see as many labels as you want