changeset 6559:6791411ed1fc

issue1370: Force second axis if at gauge.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Jul 2013 14:49:21 +0200
parents c949681a0ccb
children 767b51f8fa9c
files artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
diffstat 4 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jul 10 14:26:31 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jul 10 14:49:21 2013 +0200
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.XYPlot;
 import org.jfree.data.xy.XYSeries;
 
 import org.apache.log4j.Logger;
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Jul 10 14:26:31 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Jul 10 14:49:21 2013 +0200
@@ -88,6 +88,17 @@
     }
 
 
+    /** Overriden to show second axis also if no visible data present. */
+    @Override
+    protected void adjustAxes(XYPlot plot) {
+        super.adjustAxes(plot);
+        if (getCurrentGaugeDatum() != 0d) {
+            // Show the W[*m] axis even if there is no data.
+            plot.setRangeAxis(1, createYAxis(YAXIS.W.idx));
+        }
+    }
+
+
     public DischargeCurveGenerator() {
         super();
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java	Wed Jul 10 14:26:31 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java	Wed Jul 10 14:49:21 2013 +0200
@@ -14,6 +14,7 @@
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.ValueMarker;
+import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
 import org.w3c.dom.Document;
@@ -92,6 +93,16 @@
         return false;
     }
 
+    /** Overriden to show second axis also if no visible data present. */
+    @Override
+    protected void adjustAxes(XYPlot plot) {
+        super.adjustAxes(plot);
+        if (getCurrentGaugeDatum() != 0d) {
+            // Show the W[*m] axis even if there is no data.
+            plot.setRangeAxis(1, createYAxis(YAXIS.W.idx));
+        }
+    }
+
     /** Do Extreme Curve nonextrapolated points out. */
     protected void doExtremeCurveBaseOut(ArtifactAndFacet aaf, Document theme, boolean visible) {
         logger.debug("doExtremeCurveBaseOut");
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Wed Jul 10 14:26:31 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Wed Jul 10 14:49:21 2013 +0200
@@ -21,6 +21,7 @@
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.ValueMarker;
+import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.ui.RectangleAnchor;
@@ -153,6 +154,7 @@
         return axis;
     }
 
+    /** Returns value != 0 if the current km is not at a gauge. */
     public double getCurrentGaugeDatum() {
         if (context.getContextValue(CURRENT_KM) != null) {
             return DischargeCurveGenerator.getCurrentGaugeDatum(
@@ -162,6 +164,16 @@
         else return 0d;
     }
 
+    /** Overriden to show second axis also if no visible data present. */
+    @Override
+    protected void adjustAxes(XYPlot plot) {
+        super.adjustAxes(plot);
+        if (getCurrentGaugeDatum() != 0d) {
+            // Show the W[*m] axis even if there is no data.
+            plot.setRangeAxis(1, createYAxis(YAXIS.W.idx));
+        }
+    }
+
     /** Translate River annotations if not at gauge. */
     public void translateRiverAnnotation(RiverAnnotation riverAnnotation) {
         if (getCurrentGaugeDatum() == 0d) {

http://dive4elements.wald.intevation.org