Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
ColumnChart3D - Center X-Axis labels under columns
posted

How do I center the X-Axis labels under the column..  I want to display them horizontally by they are not centering the text, it looks like it is centering on the point of the beginning of the label.. How would I do this?

Here is my code

I make the label horizontal by setting the angle to -180

chart.Axis.X.Labels.Flip = true;
chart.Axis.X.Labels.OrientationAngle = -180;
chart.Axis.X.Labels.VerticalAlign = StringAlignment.Near;
chart.Axis.X.Labels.HorizontalAlign = StringAlignment.Near;

 

 

 

  • 995
    posted

     

    Hi,

    You can use following code in ChartDrawItem event handler to set HorizontalAlign property

    to Center:

     

     

     

     

     

     

     

    protected void UltraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e)

        {

            Text t = e.Primitive as Text;

     

     

            if (t != null && t.Path != null && t.Path.IndexOf("Grid.Z") != -1)

     

            {

                t.labelStyle.FontColor = Color.Red;

                t.labelStyle.Orientation = TextOrientation.Horizontal;

                t.labelStyle.HorizontalAlign = StringAlignment.Center;

                //t.labelStyle.RotationAngle = -90;

     

            }

     

        }