Page 1 of 1

Labels on the X Axis are cropped

Posted: Fri Jun 21, 2013 7:55 am
by 15664347
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.

Re: Labels on the X Axis are cropped

Posted: Fri Jun 21, 2013 11:15 am
by 10050769
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,

Re: Labels on the X Axis are cropped

Posted: Mon Jun 24, 2013 7:01 am
by 15664347
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

Re: Labels on the X Axis are cropped

Posted: Tue Jun 25, 2013 10:17 am
by 10050769
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,