diff flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 2398:5d8d24984819

New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator. flys-artifacts/trunk@4024 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 10 Feb 2012 10:24:33 +0000
parents cd4fb19ab892
children dce0cc856357
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Feb 10 10:20:02 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Feb 10 10:24:33 2012 +0000
@@ -49,6 +49,7 @@
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.jfree.Bounds;
 import de.intevation.flys.jfree.EnhancedLineAndShapeRenderer;
 import de.intevation.flys.jfree.StableXYDifferenceRenderer;
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
@@ -248,6 +249,14 @@
      */
     public abstract Range[] getRangesForAxis(int index);
 
+    public abstract Bounds getXBounds(int axis);
+
+    protected abstract void setXBounds(int axis, Bounds bounds);
+
+    public abstract Bounds getYBounds(int axis);
+
+    protected abstract void setYBounds(int axis, Bounds bounds);
+
 
     /**
      * This method should be used by concrete subclasses to add subtitle to
@@ -1027,7 +1036,7 @@
     }
 
 
-    protected Range getValueAxisRange() {
+    protected String[] getValueAxisRangeFromRequest() {
         Element yrange = (Element)XMLUtils.xpath(
             request,
             XPATH_CHART_Y_RANGE,
@@ -1041,30 +1050,10 @@
 
         String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
-
         String lower = yrange.getAttributeNS(uri, "from");
         String upper = yrange.getAttributeNS(uri, "to");
 
-        if (lower.length() > 0 && upper.length() > 0) {
-            try {
-                double from = Double.parseDouble(lower);
-                double to   = Double.parseDouble(upper);
-
-                if (from == 0 && to == 0) {
-                    logger.debug("No range specified. Lower and upper Y == 0");
-                    return null;
-                }
-
-                return from > to
-                       ? new Range(to, from)
-                       : new Range(from, to);
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Wrong values for value axis range.");
-            }
-        }
-
-        return null;
+        return new String[] { lower, upper };
     }
 
 

http://dive4elements.wald.intevation.org