I have a CombinedDomainXYPlot with a main XYPlot and a few subplots. For some of the subplots, I want to manually set the range of the y-axis, as it displays values that have a known range (but the datasets do not always contain data that covers values in the complete range).
However, I can't seem to set the range for these subplots as I want to. I've tried to set the range while createing the the XYPlot subplot. The code for creating the subplot:
Code: Select all
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis range= new NumberAxis("Label");
XYPlot subplot1 = new XYPlot(dataSet1, null, range, renderer1);
And then trying to set the range by:
Code: Select all
range.setRange(-axis1upper, axis1upper);
Or:
Code: Select all
range.setUpperBound(axis1upper));
range.setLowerBound(-axis1upper));
But this doesn't work. In the CombinedDomainXYPlot, the subplot is displayed, but not with the correct range on the y-axis. The range on the axis seems to be auto-ranged, based on the dataset, and is smaller than the values set above. How should I solve this?