[PATCH 2 of 2] Do not invert chart when adding point data. (issue1290)

Wald Commits scm-commit at wald.intevation.org
Tue Jul 23 09:49:25 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1374565751 -7200
# Node ID 3aa6c1f5ddc35e85927cab80b588a3a9118ce5d3
# Parent  b1e66ea7fc2b0587892285ec5c0596c5b26c6156
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.

diff -r b1e66ea7fc2b -r 3aa6c1f5ddc3 artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
--- 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);


More information about the Dive4elements-commits mailing list