However, I recently started a standalone application using JFreeChart. I have 1 dataset in an XYPlot with the primary domain axis on the bottom, the primary range on the left, the secondary domain on the top and the secondary range on the right.
When I run the application, it plots the data and axes correctly. If I click and draw a rectangle to zoom in on the plot, the data and axes are still correct. My problem is with zooming out to the original data/image. The image is correct but both secondary axes have lost their range information and reverted to a 0 to 1 range.
I am creating the secondary axes as follows:
Code: Select all
NumberAxis degreeAxis = new NumberAxis("Degree Around Hole");
degreeAxis.setLowerBound( 0.0 );
degreeAxis.setUpperBound( 360.0 );
plot.setDomainAxis(1, degreeAxis);
plot.setDomainAxisLocation( 1, AxisLocation.TOP_OR_LEFT);
NumberAxis depthAxis = new NumberAxis("Depth (in)");
depthAxis.setLowerBound( mDepthMin );
depthAxis.setUpperBount( mDepthMax );
plot.setRangeAxis(1, depthAxis);
plot.setRangeAxisLocation( 1, AxisLocation.BOTTOM_OR_RIGHT);
Code: Select all
plot.mapDatasetToDomainAxis(0, 1);
Code: Select all
plot.mapDatasetToRangeAxis(0, 1);
The code follows the examples within the JFreeChart demo for DualAxisDemos with two exceptions - I have a single dataset and I am not mapping the dataset to the axes (bad results as mentioned above). Thus, my concern is that having a single dataset is my issue, but I wanted to check the forum to see if anyone has any suggestions.
Thanks in advance,
David