Y axis tick label frequency

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

Y axis tick label frequency

Post by BH » Mon Jul 01, 2002 12:29 pm

Hi

I am using the VerticalNumberAxis for a Y axis.

I would like to know if it is possible to specify the actual number of ticks. For example, if I wanted 3 ticks at equal intervals, thus dividing the axis into 4 parts, regardless of the data, how would I do this?

Hope this makes sense!

Any help would be appreciated.

Thanks in advance

David Gilbert

Re: Y axis tick label frequency

Post by David Gilbert » Tue Jul 02, 2002 6:06 am

You would need to calculate this yourself, then call the setTickUnit method in the NumberAxis class to specify a fixed tick unit.

That's only a partial solution, because then every time the dataset updates, you would need to recalculate the tick unit and set it again. The alternative would be to create your own subclass of VerticalNumberAxis and override the autoAdjustRange method, and the selectAutoTickUnit method (which unfortunately is private, but I can change that to protected if you want to go down this route).

Regards,

DG.

Locked