Number of ticks on NumberAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
harrisx
Posts: 4
Joined: Fri Mar 30, 2007 5:36 pm

Number of ticks on NumberAxis

Post by harrisx » Fri Jun 22, 2007 12:59 pm

Hi,

is there a way to specify the (maximal) number of ticks, that appears on a NumberAxis? Setting a NumberTickUnit seems not a clever choise, because the AxisRange can change a lot.

In the docs I found:

"selectAutoTickUnit: Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping."

But most of the time this 'as many ticks as possible ' is to dense. If there fit like 15 ticks on a axis, lets say 5 ticks result in a clearer diagram.

did I miss something like "setMaxTicks()" or how can I work around?

Thanks ahead!
Harris

azr
Posts: 13
Joined: Sun Apr 29, 2007 6:05 pm

Post by azr » Wed Jun 27, 2007 12:39 pm

I dont't know if there is already a method to do that so i've overridded the drawTicksAndLabel method of the NumberAxis class.
Then i used an attribute tickPeriod and only do the drawing for this period.
I hope this will help :)

Locked