category labels cut off using autoRange

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Simon

category labels cut off using autoRange

Post by Simon » Thu Sep 19, 2002 4:17 pm

Hi,

I'm creating a standard Vertical Bar chart and have setLabelsVisible to true. I have also setAutoRange to true also. However, on the chart. the label for the bar which is closest to the highest auto range is always chopped off by the top graph border, the only way to fix it is to set a specific maximum range. Is this a bug or am I forgetting to do something?

Regards
Simon

David Gilbert

Re: category labels cut off using autoRange

Post by David Gilbert » Fri Sep 20, 2002 11:21 am

It's kind of a bug, the sort that arises because JFreeChart is developed by many people in many places.

The axis code is not aware of the fact that the renderer is drawing labels now, so it doesn't make any extra space available when doing the auto range calculation. One thing you can do is change the upper margin on the axis (5% by default). If you make it 10% or 15% then there will be more space for the labels. The method is setUpperMargin(...) in the ValueAxis class (I think).

Regards,

DG.

Locked