Is there a way to force a tick onto an Axis ?

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

Is there a way to force a tick onto an Axis ?

Post by Guest » Tue Jan 18, 2005 10:22 am

I have a NumberAxis that is autoranging - so it's choosing the tick values for the axis based upon the data in the chart.

I want to force a particular tick value to appear regardless of the data - is there a way to achieve this ?

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Tue Jan 18, 2005 11:32 am

Of course there is one:

Code: Select all

rangeAxis.setTickUnit(new NumberTickUnit(10));

rlenard
Posts: 7
Joined: Thu Jun 10, 2004 4:37 am

Post by rlenard » Tue Jan 18, 2005 10:29 pm

angel wrote:Of course there is one:

Code: Select all

rangeAxis.setTickUnit(new NumberTickUnit(10));
That will put just that tick unit on. Is there a way to add that tick unit plus what are added by default ?

rlenard
Posts: 7
Joined: Thu Jun 10, 2004 4:37 am

Post by rlenard » Wed Jan 19, 2005 3:40 am

rlenard wrote:
angel wrote:Of course there is one:

Code: Select all

rangeAxis.setTickUnit(new NumberTickUnit(10));
That will put just that tick unit on. Is there a way to add that tick unit plus what are added by default ?
You can override refreshTicks - but that is painful because you have to duplicate the direction related layout code from NumberAxis.

What would be nice is to have a method to override which returns the tick values, then refreshTicks deals ith all the layout issues. The default method would generate the standard tick values.

Locked