changeset 7104:eb3a2bc5d591 generator-refactoring

Add more Inversion logic to the DiagramGenerator The diagram generator has the inverted / not inverted logic so it should not be necessary to override some methods to make it acutally work
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 23 Sep 2013 16:00:02 +0200
parents 5009b151f146
children ab57b6eee71c
files artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Mon Sep 23 15:55:09 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java	Mon Sep 23 16:00:02 2013 +0200
@@ -188,20 +188,22 @@
 
     /**
      * 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() {
+        if (isInverted()) {
+            return (Double)getXBounds(0).getUpper();
+        }
         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() {
+        if (isInverted()) {
+            return (Double)getXBounds(0).getLower();
+        }
         return (Double)getXBounds(0).getUpper();
     }
 
@@ -833,7 +835,7 @@
 
     /**
      * Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the
-     * X axis.
+     * X axis and applies the inversion if isInverted.
      *
      * (Duplicate in TimeseriesChartGenerator)
      *
@@ -854,6 +856,11 @@
 
         xaxis.setLabelFont(labelFont);
         xaxis.setTickLabelFont(labelFont);
+
+        if (isInverted()) {
+            logger.debug("X-Axis.setInverted(true)");
+            xaxis.setInverted(true);
+        }
     }
 
 

http://dive4elements.wald.intevation.org