Labels on the X Axis are cropped

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 21
Joined: Mon Dec 10, 2012 12:00 am

Labels on the X Axis are cropped

Post by OMP » Fri Jun 21, 2013 7:55 am

Dear,

If we have long text labels on the X Axis, the first label gets cropped when we rotate them. see screenshot attached.
What can I do to make sure that the label does not get chopped off.

thanks,

Marijke Van Bergen
OM Partners.
Attachments
Capture.PNG
Capture.PNG (56.84 KiB) Viewed 6969 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Labels on the X Axis are cropped

Post by Sandra » Fri Jun 21, 2013 11:15 am

Hello Marijke Van Bergen,

I recommend try to increase the space of MarginLeft adjusting it to your convenience. For example, you can do something as next:

Code: Select all

      tChart1.Panel.MarginLeft = 10;
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

OMP
Newbie
Newbie
Posts: 21
Joined: Mon Dec 10, 2012 12:00 am

Re: Labels on the X Axis are cropped

Post by OMP » Mon Jun 24, 2013 7:01 am

The problem with this solution is that our data on the chart (including the labels) in very dynamic. We never know the length of the labels, so setting a hard coded margin is not the best solution. We are looking for a solution that takes into account the length of the labels.

Kind regards,
Marijke

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Labels on the X Axis are cropped

Post by Sandra » Tue Jun 25, 2013 10:17 am

Hello OMP,

You can use MaxLabelsWidth to calculate the width of your labels:

Code: Select all

 private void CalcMargins()
    {
      tChart1.Draw();
      tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
      tChart1.Panel.MarginLeft = tChart1.Panel.MarginLeft+tChart1.Axes.Bottom.MaxLabelsWidth();
    }
My recommendation is you use a similar code as previous to fix your problem.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply