diff artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java @ 8455:6dfc3a1fc70d

(issue1764) Set upper-time and lower-time for time series axes This introduces new optional chart settings. Upper-time and lower-time. If they are present the client can show a date selection and they can be used for the domain axis in timeseries diagrams.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 29 Oct 2014 19:51:39 +0100
parents 42b258294067
children be5ce2882708
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java	Wed Oct 29 19:49:18 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java	Wed Oct 29 19:51:39 2014 +0100
@@ -141,7 +141,7 @@
      * Shortcut, especially to be overridden in (LS) charts where
      * axis could be inverted.
      */
-    protected double getLeftX() {
+    protected long getLeftX() {
         return (Long)getXBounds(0).getLower();
     }
 
@@ -151,7 +151,7 @@
      * Shortcut, especially to be overridden in (LS) charts where
      * axis could be inverted.
      */
-    protected double getRightX() {
+    protected long getRightX() {
         return (Long)getXBounds(0).getUpper();
     }
 
@@ -839,5 +839,28 @@
         }
     }
 
+    /* Create an axis section with setUpperTimeRange and
+     * setLowerTimeRange */
+    @Override
+    protected List<AxisSection> buildXAxisSections() {
+        List<AxisSection> axisSections = new ArrayList<AxisSection>();
+
+        String identifier = "X";
+
+        AxisSection axisSection = new AxisSection();
+        axisSection.setIdentifier(identifier);
+        axisSection.setLabel(getXAxisLabel());
+        axisSection.setFontSize(14);
+        axisSection.setFixed(false);
+
+        axisSection.setUpperTimeRange(getRightX());
+        axisSection.setLowerTimeRange(getLeftX());
+
+        axisSections.add(axisSection);
+
+        return axisSections;
+    }
+
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org