changeset 1688:7eb9015489b0

Worked on flys/issue150 flys-artifacts/trunk@2908 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 07 Oct 2011 15:55:38 +0000
parents 19c4cf5163e8
children e9475d2ef343
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 3 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Oct 07 13:33:10 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Oct 07 15:55:38 2011 +0000
@@ -1,3 +1,19 @@
+2011-10-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Worked on flys/issue150 (Diagramm: Anzeige von W bergauf).
+	Still does not work in all cases.
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java (generateChart()):
+	  Reordered calls to ensure that the inversion of the x axis is
+	  not eliminated by other chart generation steps as a side effect.
+
+	 * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	   Assuming that JFreeChart is inverting axis automatically if the
+	   KMs are reversed ordered only do invert only in some situations.
+
+	   Do not invert axis for Q (@Ingo: This is wrong! We must do this
+	   if we are only displaying the Qs and the Ws are deactived).
+
 2011-10-07  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Oct 07 13:33:10 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Oct 07 15:55:38 2011 +0000
@@ -22,7 +22,9 @@
 import de.intevation.flys.artifacts.model.WQKms;
 
 import de.intevation.flys.jfree.FLYSAnnotation;
+
 import de.intevation.flys.utils.FLYSUtils;
+import de.intevation.flys.utils.DataUtil;
 
 
 /**
@@ -238,13 +240,20 @@
 
         int size = wqkms.size();
 
+        boolean wsUp = wqkms.guessWaterIncreasing();
+        boolean kmUp = DataUtil.guessWaterIncreasing(wqkms.allKms());
+        boolean inv  = !(kmUp && !wsUp);
+
         if (logger.isDebugEnabled()) {
-            if (wqkms.size() > 0) {
-                logger.debug("Generate series: " + series.getKey());
+            logger.debug("Generate series: " + series.getKey());
+            logger.debug("Values  : " + size);
+            if (size > 0) {
                 logger.debug("Start km: " + wqkms.getKm(0));
                 logger.debug("End   km: " + wqkms.getKm(size-1));
-                logger.debug("Values  : " + size);
             }
+            logger.debug("wsUp: " + wsUp);
+            logger.debug("kmUp: " + kmUp);
+            logger.debug("inv:  " + inv);
         }
 
         for (int i = 0; i < size; i++) {
@@ -253,7 +262,7 @@
 
         addFirstAxisSeries(series, visible);
 
-        if (wqkms.guessWaterIncreasing()) {
+        if (inv) {
             setInverted(true);
         }
     }
@@ -287,9 +296,9 @@
 
         addSecondAxisSeries(series, visible);
 
-        if (wqkms.guessWaterIncreasing()) {
-            setInverted(true);
-        }
+        //if (wqkms.guessWaterIncreasing()) {
+        //    setInverted(true);
+        //}
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Oct 07 13:33:10 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Oct 07 15:55:38 2011 +0000
@@ -130,7 +130,6 @@
         addAnnotations(plot);
         addSubtitles(chart);
         adjustPlot(plot);
-        adjustAxes(plot);
         localizeAxes(plot);
 
         removeEmptyRangeAxes(plot);
@@ -139,6 +138,7 @@
         autoZoom(plot);
 
         applyThemes(plot);
+        adjustAxes(plot);
 
         return chart;
     }

http://dive4elements.wald.intevation.org