I have what is hopefully a simple question about the display area of a chart when explicitly setting an axis range.
I create an axis like this in the usual way:
Code: Select all
NumberAxis xAxis = new NumberAxis("X Axis");
xAxis.setRange(new Range(0.0, 2.0), true, true);
plot.setDomainAxis(xAxis);
Then I print out the upper and lower bounds on the axis from debug code and they are 0.0 and 2.0 respectively.
Code: Select all
System.out.println("xAxis range: " + xAxis.getRange().getLowerBound() + " " + xAxis.getRange().getUpperBound());
xAxis range: 0.0 2.0
So far so good. This range looks correct from what I set.
But when I actually show the chart, the range that actually displays is truncated to some lower value which looks to be around 1.6 or so.
Curiously enough, when I use the ChartPanel's right click menu to reset the zoom, it also uses this (arbitrary?) value as the upper bound on the axis.
My question is basically, why would the chart do this and not display the entire range if I have set it explicitly on the XYPlot's axis? Is there some behind the scenes interaction with the tick settings that might do this?
And how can I force a chart to display exactly the range I have set on the axis rather than trying to do something clever which is not what I want?

If I play around with other values, sometimes it doesn't do this and displays the full range. The problems with display of range seem to occur when the total range of the axis is small like 2.0 or less. For larger ranges, it seems to behave more reasonably in this respect.
Any tips appreciated.
(If you need more thorough example code to show the problem from scratch, I can try to provide it.)
Thanks.
--Jeremy