I have an app that shows various XY Line plots. I have added annotations to several. One of my plots has a large circle annotation. Basically, the circle represents the lines in the plots entering a field of view. It all works correctly, except the plot defaults to center on the lines, so the circle is off center and part of it goes off the screen. I can would like it to center on the circle annotation. I can accomplish this with the following code:

// minX, maxX, minY and maxY are the coordinates of the circle + some padding

plot.getRangeAxis().setAutoRangeMinimumSize(Math.abs(MaxX)+Math.abs(MinX));

plot.getDomainAxis().setAutoRangeMinimumSize(Math.abs(MaxY)+Math.abs(MinY));

plot.getRangeAxis().centerRange(Math.abs(MaxX)-Math.abs(MinX));

plot.getDomainAxis().centerRange(Math.abs(MaxY)-Math.abs(MinY));

This works well, except if you zoom in and then try to go back to the default plot size, the plot goes back to centering on the plots themselves, not the circle.

I would like the plot to center on the annotation instead.

thanks,

John