set Minimum tick unit count

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
pelski
Posts: 16
Joined: Thu Feb 23, 2006 2:02 am

set Minimum tick unit count

Post by pelski » Tue Mar 14, 2006 8:14 am

Hi,

I would like to know if it is possible to set the minimum amount
of TickUnits shown on a ValueAxis in a XYPlot.
I am using my own StandardTickUnits, via the setStandardTickUnits
method on the ValueAxis.

I noticed that then calculateVisibleTickCount in NumberAxis always returns
1 for a certain set of data and image size, regardless of the number of datapoints in the series.
Is this behaviour possible to change?

Regards,
Nick

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Mar 14, 2006 9:57 am

No. The auto tick unit selection mechanism will choose the smallest tick unit---from your collection of "standard" units---that it can display without the labels overlapping.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

pelski
Posts: 16
Joined: Thu Feb 23, 2006 2:02 am

Post by pelski » Wed Mar 15, 2006 8:53 am

david.gilbert wrote:No. The auto tick unit selection mechanism will choose the smallest tick unit---from your collection of "standard" units---that it can display without the labels overlapping.
The chart just looks really wierd with only one tick-unit value displayed.
This is usually 0, and then punters have no other point of reference
for the line. Is there a way to maybe scale the axis so that you
get at least two labels showing?

Cheers,
Nick

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Mar 15, 2006 3:58 pm

You said you specified your own standard tick units - try adding a smaller tick unit to your collection.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

pelski
Posts: 16
Joined: Thu Feb 23, 2006 2:02 am

Post by pelski » Thu Mar 16, 2006 12:31 am

david.gilbert wrote:You said you specified your own standard tick units - try adding a smaller tick unit to your collection.
Right, but when I add the tick units, I do not know the size the of the graph, size of the labels etc. All this gets done at renering time in NumberAxis in the method: calculateVisibleTickCount. If this method returns < 2, then it would be good if the chart could rescale, so that at least two Tick Units are visible.
Does this make sense?

Locked