changeset 6635:3aa6c1f5ddc3

Do not invert chart when adding point data. (issue1290) If the wkms size == 1 guessWaterIncreasing is always false in that cases the diagram was inverted. See issue1290 for rationale.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 23 Jul 2013 09:49:11 +0200
parents b1e66ea7fc2b
children 65a5deaee769
files artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Mon Jul 22 17:40:41 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Tue Jul 23 09:49:11 2013 +0200
@@ -104,9 +104,8 @@
     public void invertAxis(XYChartGenerator generator, WKms wkms) {
         boolean wsUp = wkms.guessWaterIncreasing();
         boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms());
-        boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
-
         int size = wkms.size();
+        boolean inv = ((wsUp && kmUp) || (!wsUp && !kmUp)) && size > 1;
 
         if (logger.isDebugEnabled()) {
             logger.debug("(Wkms)Values  : " + size);
@@ -116,6 +115,9 @@
             }
             logger.debug("wsUp: " + wsUp);
             logger.debug("kmUp: " + kmUp);
+            if (size == 1) {
+                logger.debug("InvertAxis not inverting because we have just one km");
+        }
             logger.debug("inv:  " + inv);
         }
         generator.setInverted(inv);

http://dive4elements.wald.intevation.org