Number of ticks

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

Number of ticks

Post by Jim Kerwood » Tue Aug 13, 2002 10:28 pm

Hi all,
I am trying to create a date graph that a user selects a start and end time. I want the number of ticks to be within a specified range i.e. 5-12 ticks. Is there a way to find out the number of ticks that result in a graph with a specified range and tick unit? Then if it is outside my range I can adjust my tick unit for the user dynamically.

Thanks
Jim

David Gilbert

Re: Number of ticks

Post by David Gilbert » Wed Aug 14, 2002 9:49 am

Hi Jim,

There's no access to this information via the API, but the Axis class does maintain a list of ticks...so if you subclass the HorizontalDateAxis class you should be able to access this list and find out how many ticks there are.

I can add a method to the Axis class (public int getTickCount()) for the next release if this helps...

Regards,

DG.

Locked