Mercurial > dive4elements > river
changeset 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 | 46a2a5dc98b7 |
children | 33ade8153d74 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java |
diffstat | 3 files changed, 38 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Sep 27 14:03:06 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Sep 27 14:37:18 2011 +0000 @@ -1,3 +1,15 @@ +2011-09-27 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Enable "auto-scaling" axis for waterlevels in WDifference-plots. + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + (createSecondaryAxis, zoomY): Refactored to allow modification in + siblings. + + * src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java: + (createSecondaryAxisRange): Override to achieve expected behavior. + Also adjusted label. + 2011-09-27 Felix Wolfsteller <felix.wolfsteller@intevation.de> In W-Difference Calculation, respect indices of selected facets.
--- 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);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Tue Sep 27 14:03:06 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Tue Sep 27 14:37:18 2011 +0000 @@ -6,6 +6,7 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.chart.title.TextTitle; import org.jfree.data.xy.XYSeries; +import org.jfree.data.Range; import org.w3c.dom.Document; @@ -51,6 +52,7 @@ public static final String I18N_CHART_TITLE_DEFAULT = "W-Differenzen"; public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; public static final String I18N_YAXIS_LABEL_DEFAULT = "W [m]"; + public static final String I18N_2YAXIS_LABEL_DEFAULT = "W [NN + m]"; /** @@ -180,7 +182,17 @@ } } + /** + * Disable Longitudinals behaviour to include "0" in the Q axis. + * @param range range with which to look up upper bound. + * @return range to be used for "auto-scaling" axis. + */ + @Override + protected Range createSecondAxisRange(Range range) { + return new Range(range.getLowerBound(), range.getUpperBound()); + } + /** * */