changeset 6429:e32b166c881b

issue1370: Add discharge q data to second axis.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 26 Jun 2013 12:40:27 +0200
parents 39aba54a4c15
children fab4abd00ef2
files artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
diffstat 1 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:38:54 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:40:27 2013 +0200
@@ -167,7 +167,7 @@
         //XXX DEAD CODE // Facet facet = artifactFacet.getFacet();
 
         if (name.equals(COMPUTED_DISCHARGE_Q)) {
-            doQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
+            doDischargeQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
         }
         else if (name.equals(STATIC_WQ)) {
             doWQOut(artifactFacet.getData(context), artifactFacet, attr, visible);
@@ -242,6 +242,38 @@
 
 
     /**
+     * Add discharge Q-Series to plot, scale if at gauge.
+     * @param wqkms actual data
+     * @param theme theme to use.
+     */
+    protected void doDischargeQOut(
+        WQKms            wqkms,
+        ArtifactAndFacet aaf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("ComputedDischargeCurveGenerator: doDischargeQOut");
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+
+        int subtractPNP = atGaugeSubtractPNP();
+
+        if (subtractPNP == 0) {
+            StyledSeriesBuilder.addPointsQW(series, wqkms);
+            addAxisSeries(series, YAXIS.W.idx, visible);
+        }
+        else {
+            XYSeries series2 = new StyledXYSeries(aaf.getFacetDescription(), theme);
+            StyledSeriesBuilder.addPointsQW(series2, wqkms);
+            addAxisSeries(series2, YAXIS.W.idx, false);
+
+            // Use second axis...
+            StyledSeriesBuilder.addPointsQW(series, wqkms, -subtractPNP, 100d);
+            addAxisSeries(series, YAXIS.WCm.idx, visible);
+        }
+    }
+
+
+    /**
      * Add Q-Series to plot.
      * @param wqkms actual data
      * @param theme theme to use.

http://dive4elements.wald.intevation.org