changeset 718:f3fd8c9b7f51

#157 Computed discharge curve charts always have a lower bound set to 0. flys-artifacts/trunk@2192 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 21 Jun 2011 18:10:49 +0000
parents be4709640aac
children 035c0095b427
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 3 files changed, 39 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 21 17:39:29 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 21 18:10:49 2011 +0000
@@ -1,3 +1,15 @@
+2011-06-21  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue157 (Diagramm: Ursprung berechnete Abflusskurve)
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java: Splitted
+	  up zooming for x and y axes to be able to override specific axis
+	  zoom behaviour.
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
+	  The lower bound of the x axis (which is the Q axis in such chart) is
+	  always 0.
+
 2011-06-21  Ingo Weinzierl <ingo@intevation.de>
 
 	  flys/issue90 (Diagramm: Trennung derDiagrammfläche und Achsenaufheben)
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Tue Jun 21 17:39:29 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Tue Jun 21 18:10:49 2011 +0000
@@ -5,7 +5,10 @@
 import org.w3c.dom.Document;
 
 import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.title.TextTitle;
+import org.jfree.data.Range;
 
 import de.intevation.artifacts.Artifact;
 
@@ -70,6 +73,18 @@
 
 
     @Override
+    protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) {
+        boolean zoomin = super.zoom(plot, axis, range, x);
+
+        if (!zoomin) {
+            axis.setLowerBound(0d);
+        }
+
+        return zoomin;
+    }
+
+
+    @Override
     public void doOut(Artifact artifact, Facet facet, Document attr) {
         String name = facet != null ? facet.getName() : null;
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Jun 21 17:39:29 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Jun 21 18:10:49 2011 +0000
@@ -133,7 +133,7 @@
 
             if (i == 0) {
                 ValueAxis xaxis = plot.getDomainAxis();
-                zoom(plot, xaxis, ranges[0], xrange);
+                zoomX(plot, xaxis, ranges[0], xrange);
             }
 
             ValueAxis yaxis = plot.getRangeAxis(i);
@@ -142,11 +142,21 @@
                 continue;
             }
 
-            zoom(plot, yaxis, ranges[1], yrange);
+            zoomY(plot, yaxis, ranges[1], yrange);
         }
     }
 
 
+    protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) {
+        return zoom(plot, axis, range, x);
+    }
+
+
+    protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
+        return zoom(plot, axis, range, x);
+    }
+
+
     /**
      * Zooms the x axis to the range specified in the attribute document.
      *

http://dive4elements.wald.intevation.org