diff flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3621:6772e9f9b65f

Deal with inverted axes in longitudinal charts and logos. flys-artifacts/trunk@5297 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 29 Aug 2012 14:43:26 +0000
parents 1cd6114603d9
children 119b8ba2b77f
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Aug 29 14:33:48 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Aug 29 14:43:26 2012 +0000
@@ -252,6 +252,26 @@
     }
 
 
+    /**
+     * Return left most data points x value (on first axis).
+     * Shortcut, especially to be overridden in (LS) charts where
+     * axis could be inverted.
+     */
+    protected double getLeftX() {
+        return (Double)getXBounds(0).getLower();
+    }
+
+
+    /**
+     * Return right most data points x value (on first axis).
+     * Shortcut, especially to be overridden in (LS) charts where
+     * axis could be inverted.
+     */
+    protected double getRightX() {
+        return (Double)getXBounds(0).getUpper();
+    }
+
+
     /** Add a logo as background annotation to plot. */
     protected void addLogo(XYPlot plot) {
         String logo = showLogo();
@@ -296,10 +316,10 @@
             placeh = "center";
         }
         if (placeh.equals("left")) {
-            xPos = (Double)getXBounds(0).getLower();
+            xPos = getLeftX();
         }
         else if (placeh.equals("right")) {
-            xPos = (Double)getXBounds(0).getUpper();
+            xPos = getRightX();
         }
         else if (placeh.equals("center")) {
             xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d;

http://dive4elements.wald.intevation.org