if (plot instanceof XYPlot) {
XYPlot xyPlot = (XYPlot) plot;
ValueAxis rAxis = xyPlot.getRangeAxis();
if (rAxis instanceof NumberAxis) {
NumberAxis nAxis = (NumberAxis) rAxis;
if (lowerRangeVal != upperRangeVal) {
nAxis.setLowerBound(lowerRangeVal);
nAxis.setUpperBound(upperRangeVal);
}
nAxis.resizeRange(zoomFactor);
if (! Double.isNaN(anchorValueR))
nAxis.centerRange(anchorValueR);
}
ValueAxis dAxis = xyPlot.getDomainAxis();
if (dAxis instanceof DateAxis) {
((DateAxis) dAxis).setMinimumDate(lowerDomainValD.getTime());
((DateAxis) dAxis).setMaximumDate(upperDomainValD.getTime());
} else if (dAxis instanceof NumberAxis) {
NumberAxis nAxis = (NumberAxis) dAxis;
if (lowerDomainValN != upperDomainValN) {
nAxis.setRange(lowerDomainValN, upperDomainValN);
}
if (! Double.isNaN(anchorValueD))
nAxis.centerRange(anchorValueD);
}
} else if (plot instanceof CategoryPlot) {
CategoryPlot catPlot = (CategoryPlot) plot;
NumberAxis axis = (NumberAxis) catPlot.getRangeAxis();
axis.setLowerBound(lowerRangeVal);
axis.setUpperBound(upperRangeVal);
axis.resizeRange(zoomFactor);
}
}