PlotNavigator extends AbstractNavigator { public void reset() { double zoomOld = getZoom(); double zoomNew = 1.0; PointND<? extends Number> centerOld = getCenter(); List<String> axesNames = getAxes(); Double[] centerCoordsOriginal = new Double[centerOld.getDimensions()]; int axisIndex = 0; for (String axisName : axesNames) { NavigationInfo info = getInfo(axisName); if (info != null) { double centerCoordOriginal = info.getCenterOriginal(); centerCoordsOriginal[axisIndex] = centerCoordOriginal; info.setCenter(centerCoordOriginal); info.setZoom(zoomNew); } axisIndex++; } PointND<Double> centerNew = new PointND<>(centerCoordsOriginal); NavigationEvent<PointND<? extends Number>> panEvent = new NavigationEvent<>(this, centerOld, centerNew); fireCenterChanged(panEvent); NavigationEvent<Double> zoomEvent = new NavigationEvent<>(this, zoomOld, 1.0); fireZoomChanged(zoomEvent); refresh(); } PlotNavigator(Plot plot, List<String> axesNames);  PlotNavigator(Plot plot, String... axesNames); double getZoom(); void setZoom(double zoomNew); PointND<? extends Number> getCenter(); void setCenter(PointND<? extends Number> center); void pan(PointND<? extends Number> deltas); void setDefaultState(); void reset();  }
@Test public void testReset() { nav.setZoom(2.0); nav.setCenter(new PointND<>(6.0, 0.0)); nav.reset(); assertEquals(1.0, plot.getAxis(XYPlot.AXIS_X).getMin().doubleValue(), DELTA); assertEquals(9.0, plot.getAxis(XYPlot.AXIS_X).getMax().doubleValue(), DELTA); }