diff flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 4432:e8a4d2fd25cc

Merged.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 07 Nov 2012 09:47:44 +0100
parents 8b4988815974
children 5b8919ef601d
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Nov 07 09:47:44 2012 +0100
@@ -254,6 +254,8 @@
      * axis could be inverted.
      */
     protected double getLeftX() {
+            // TODO if the range null...
+        //return (Double)getDomainAxisRange().getLowerBound();
         return (Double)getXBounds(0).getLower();
     }
 
@@ -264,12 +266,27 @@
      * axis could be inverted.
      */
     protected double getRightX() {
-        return (Double)getXBounds(0).getUpper();
+        return (Double)getXBounds(0).getLower();
+        //return (Double)getDomainAxisRange().getUpperBound();
     }
 
+    protected double getBottomY() {
+        Range zoomedRange = getValueAxisRange();
+        return (zoomedRange != null)
+               ? zoomedRange.getLowerBound()
+               : (Double)getYBounds(0).getLower();
+    }
+
+    protected double getTopY() {
+        Range zoomedRange = getValueAxisRange();
+        return (zoomedRange != null)
+               ? zoomedRange.getUpperBound()
+               : (Double)getYBounds(0).getUpper();
+    }
 
     /** Add a logo as background annotation to plot. */
     protected void addLogo(XYPlot plot) {
+        // TODO getValue/DomainAxisRange, so that the current zoom level is respected
         String logo = showLogo();
         if (logo  == null) {
             logger.debug("No logo to show chosen");
@@ -299,7 +316,6 @@
         }
         imageIcon = new ImageIcon(imageURL);
 
-
         double xPos = 0d, yPos = 0d;
 
         String placeh = logoHPlace();
@@ -309,13 +325,13 @@
             placev = "top";
         }
         if (placev.equals("top")) {
-            yPos = (Double)getYBounds(0).getUpper();
+            yPos = getTopY();
         }
         else if (placev.equals("bottom")) {
-            yPos = (Double)getYBounds(0).getLower();
+            yPos = getBottomY();
         }
         else if (placev.equals("center")) {
-            yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d;
+            yPos = (getTopY() + getBottomY())/2d;
         }
         else {
             logger.debug("Unknown place-v value: " + placev);
@@ -331,7 +347,9 @@
             xPos = getRightX();
         }
         else if (placeh.equals("center")) {
+            // TODO: Hier noch
             xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d;
+                   // ->->-> (getDomainAxisRange().getUpperBound() + getDomainAxisRange().getLowerBound())/2d;
         }
         else {
             logger.debug("Unknown place-h value: " + placeh);
@@ -685,6 +703,7 @@
     }
 
 
+    /** Return range of domain axis. */
     protected Range getDomainAxisRange() {
         String[] ranges = getDomainAxisRangeFromRequest();
 
@@ -724,7 +743,9 @@
         String[] ranges = getValueAxisRangeFromRequest();
 
         if (ranges == null || ranges.length < 2) {
-            logger.debug("No range specified. Lower and upper Y == 0");
+            logger.warn("No range (or not enogh) specified.");
+            if (ranges == null) logger.warn("ranges is null here");
+            else logger.warn("ranges has just one element.");
             return null;
         }
 
@@ -747,6 +768,7 @@
             }
         }
 
+        logger.warn("One of the range elements is zero length text.");
         return null;
     }
 
@@ -1034,6 +1056,5 @@
 
         return hash;
     }
-
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org