Tick unit shift of 0.05 on xy plot ?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
oromb
Posts: 1
Joined: Mon Mar 08, 2010 11:15 am
antibot: No, of course not.

Tick unit shift of 0.05 on xy plot ?

Post by oromb » Mon Mar 08, 2010 11:46 am

Hi,

I'm using Jasper reports with a XY-plot using a graph customizer class.

When I set the Y-axis on my XY plot below, I see the following tick values on my axis:

3.15, 3.5, 3.85, 4.2, 4.55, 4.9, 5.25, 5.6.

But with the values I have of
range :3.10 - 5.90 (minY, maxY)
tick unit of .35 (bandwidth).

I would expect the 1st tick being 3.10, the second 3.45, etc. I mean, without the shift of 0.05.
How do I solve this ?

Code: Select all

Double maxY = 5.9;
Double minY = 3.1;
Double baseLine = 4.5;
Double bandWidth = .35;

plot = (XYPlot) chart.getPlot();

NumberAxis axis = (NumberAxis) plot.getRangeAxis();

axis.setAutoRange(false);
axis.setAutoTickUnitSelection(false);
axis.setTickMarksVisible(true);
axis.setTickLabelsVisible(true);
minY = baseLine - 3 * bandWidth;
maxY = baseLine + 3 * bandWidth;
axis.setRange(minY, maxY);
axis.setTickUnit(new NumberTickUnit(bandWidth));

Locked