class ZoomEstimator extends Estimator {

    protected double calculateZoom(SampledXYSeries series, RectRegion visibleBounds) {
        RectRegion seriesBounds = series.getBounds();
        final double ratio = seriesBounds.getxRegion().ratio(visibleBounds.getxRegion()).doubleValue();
        final double maxFactor = series.getMaxZoomFactor();
        final double factor = Math.abs(Math.round(maxFactor / ratio));
        return factor > 0 ? factor : 1;
    }

}