changeset 1941:0fa53fa65401

Fix LongitudinalSections multi-axes plotting behavior. flys-artifacts/trunk@3322 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 28 Nov 2011 14:38:46 +0000
parents 0d12e70766c8
children be1270c10d9a
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 2 files changed, 15 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Nov 28 14:36:56 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Nov 28 14:38:46 2011 +0000
@@ -1,3 +1,11 @@
+2011-11-28  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Fix LongitudinalSections multi-axes plotting behavior.
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  Removed obsolete functions, use better working multi-axis
+	  magic by XYChartGenerator.
+
 2011-11-28  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	Overhaul dataset/axis/renderer housekeeping in Mother of all
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Mon Nov 28 14:36:56 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Mon Nov 28 14:38:46 2011 +0000
@@ -189,6 +189,13 @@
             label = "TODO: diff";
         }
         NumberAxis axis = new NumberAxis(label);
+        // "Q" Axis shall include 0.
+        if (index == YAXIS.Q.idx) {
+            axis.setAutoRangeIncludesZero(true);
+        }
+        else {
+            axis.setAutoRangeIncludesZero(false);
+        }
         axis.setLabelFont(labelFont);
         return axis;
     }
@@ -221,34 +228,6 @@
 
 
     /**
-     * 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) {
-        if (range == null) {
-            return null;
-        }
-        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 = createSecondAxisRange(range);
-        }
-
-        return super.zoomY(plot, axis, range, x);
-    }
-
-
-    /**
      * This method inverts the x-axis based on the kilometer information of the
      * selected river. If the head of the river is at kilometer 0, the axis is
      * not inverted, otherwise it is.

http://dive4elements.wald.intevation.org