Page 1 of 1

TChart axis labels cut off

Posted: Thu Aug 04, 2011 1:49 pm
by 16459935
Hi,

We're using a TChart in our cataloguing programs to display statistics about a user's collection. We have a weird situation that the labels for the bottom axis in a bar chart are sometimes cut off. It's not exactly clear in which conditions this happens, but it looks like a bug in the component, since all we do is add the numbers and labels.
Here's a screen shot of what it looks like. The TChart component is aligned to client:

Image

The labels on the bottom axis are in a 90 degree angle. The rest of the axis settings are pretty much default.
Is there a setting I'm missing? Or could this be a bug in the component. It's pretty hard to show you in a sample project. It may be related to how high the bars are and the string length of the labels.

Thanks,

Ronald
Collectorz.com

Re: TChart axis labels cut off

Posted: Thu Aug 04, 2011 3:13 pm
by yeray
Hi Ronald,

If you are using a custom horizontal axis you'll have to add some extra bottom margin manually. You could use the axis MaxLabelsWidth and use this value (with some extra pixels for the ticks length) as Bottom Margin:

Code: Select all

    Chart1.MarginUnits:=muPixels;
    Chart1.MarginBottom:=Chart1.CustomAxes[0].MaxLabelsWidth + 10;

Re: TChart axis labels cut off

Posted: Mon Aug 08, 2011 10:15 am
by 16459935
Thanks Yeray! That worked like a charm.