changeset 720:d60cc6453d45

#161 Include the 0 on the second y axis (the Q axis) in longitudinal section charts intially. flys-artifacts/trunk@2194 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Jun 2011 06:51:36 +0000
parents 035c0095b427
children 7298d58a1f5a
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 21 21:41:49 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 22 06:51:36 2011 +0000
@@ -1,3 +1,12 @@
+2011-06-22  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue161 (Diagramm: Q-Achse in W-Längsschnitten immer bei Q=0)
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  The Q axis (which is the second y axis) initially contains the 0 value.
+	  After a zoom action has taken place, this behaviour is no longer
+	  supported.
+
 2011-06-21  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
     Draw correction curve again.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Tue Jun 21 21:41:49 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Wed Jun 22 06:51:36 2011 +0000
@@ -10,6 +10,7 @@
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
+import org.jfree.data.Range;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
 
@@ -159,6 +160,23 @@
 
 
     /**
+     * This method overrides the XYChartGenerators zoomY method to include the 0
+     * value on the Q axis.
+     */
+    @Override
+    protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
+        boolean zoomin = super.zoomY(plot, axis, range, x);
+
+        // we want the Q axis to start at 0 if no zooming has been done
+        if (!zoomin && plot.getRangeAxisIndex(axis) == 1) {
+            axis.setLowerBound(0d);
+        }
+
+        return zoomin;
+    }
+
+
+    /**
      * 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