Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1653:73794985a899
Enable auto-scaling axis for waterlevels in WDifference-plots.
flys-artifacts/trunk@2845 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 27 Sep 2011 14:37:18 +0000 |
parents | 3067e700fc13 |
children | f1af0c07a6ee |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Sep 27 14:03:06 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Sep 27 14:37:18 2011 +0000 @@ -177,14 +177,24 @@ /** - * This method overrides the XYChartGenerators zoomY method to include the 0 - * value on the Q axis. + * Create a range that includes 0 (for the Q axis). + * @param range range with which to look up upper bound. + * @return range with 0 included. + */ + protected Range createSecondAxisRange(Range range) { + return new Range(0d, range.getUpperBound()); + } + + + /** + * This method overrides the XYChartGenerators zoomY method to be able to + * modify the range of the Q axis (here, it shall include 0). */ @Override protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { if (plot.getRangeAxisIndex(axis) == 1) { - // we want the Q axis to start at 0 if no zooming has been done - range = new Range(0d, range.getUpperBound()); + // We want the Q axis to start at 0 if no zooming has been done. + range = createSecondAxisRange(range); } return super.zoomY(plot, axis, range, x);