DomainAxis Problem

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
AlanH99
Posts: 18
Joined: Wed Apr 05, 2006 3:31 pm
Location: Edinburgh UK

DomainAxis Problem

Post by AlanH99 » Thu Jun 15, 2006 9:30 am

I'm having some problems specifying the values for the X-Axis correctly - please see the images from the below:

http://alanhay.ndo.co.uk/images/

The X-Axis should be a sequence like:

4,6,8,10,12,14,16,18,20 - drawn correctly

5,7,9,11,13,15,17,19,21 - drawn as in incorrect.jpeg

However in some cases it will not draw correctly.

Currently I am trying to use the methods:

setyLowerBound()
setUpperBound()
setTickUnit()

Using values 5,21 gives incorrect_2.jpg

Using values 5,21,2 gives incorrect_1.jpg

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 » Thu Jun 15, 2006 10:05 am

The tick marks and labels always fall on multiples of the tick size, so it won't let you have just odd numbers. You can subclass the NumberAxis class and override the refreshTicks() method to return any tick values that you want, though.
David Gilbert
JFreeChart Project Leader

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

AlanH99
Posts: 18
Joined: Wed Apr 05, 2006 3:31 pm
Location: Edinburgh UK

Post by AlanH99 » Thu Jun 15, 2006 2:24 pm

Ok cheers. That seems to have fixed the problem.

Locked