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));