diff artifacts/src/main/java/org/dive4elements/river/exports/ChartSettings.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 e4606eae8ea5
children 5e38e2924c07
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartSettings.java	Wed Oct 29 19:49:18 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartSettings.java	Wed Oct 29 19:51:39 2014 +0100
@@ -212,6 +212,8 @@
         String low      = XMLUtils.xpathString(axis, "lower", null);
         String up       = XMLUtils.xpathString(axis, "upper", null);
         String sugLabel = XMLUtils.xpathString(axis, "suggested-label", null);
+        String lowTime  = XMLUtils.xpathString(axis, "lower-time", null);
+        String upTime   = XMLUtils.xpathString(axis, "upper-time", null);
 
         if (log.isDebugEnabled()) {
             log.debug("Found axis id:        '" + id + "'");
@@ -220,6 +222,8 @@
             log.debug("Found axis fixation:  '" + fixation + "'");
             log.debug("Found axis lower:     '" + low + "'");
             log.debug("Found axis upper:     '" + up + "'");
+            log.debug("Found axis lower-time:'" + lowTime + "'");
+            log.debug("Found axis upper-time:'" + upTime + "'");
             log.debug("Found axis sug. label:'" + sugLabel + "'");
         }
 
@@ -227,8 +231,13 @@
         section.setLabel(label);
         section.setFontSize(Integer.parseInt(fSize.length() > 0 ? fSize : "-1"));
         section.setFixed(Boolean.valueOf(fixation));
-        section.setLowerRange(Double.parseDouble(low.length() > 0 ? low : "0"));
-        section.setUpperRange(Double.parseDouble(up.length() > 0 ? up : "0"));
+        if (upTime != null && !upTime.isEmpty() && lowTime != null && !lowTime.isEmpty()) {
+            section.setLowerTimeRange(Long.parseLong(lowTime));
+            section.setUpperTimeRange(Long.parseLong(upTime));
+        } else {
+            section.setLowerRange(Double.parseDouble(low.length() > 0 ? low : "0"));
+            section.setUpperRange(Double.parseDouble(up.length() > 0 ? up : "0"));
+        }
         section.setSuggestedLabel(sugLabel);
 
         target.addAxisSection(section);

http://dive4elements.wald.intevation.org