diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 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 56d70e546800
line wrap: on
line diff
--- 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