[Dive4elements-commits] [PATCH 4 of 9] issue1370: Let a hypothetical second y axis be an SyncNumberAxis depending on first

Wald Commits scm-commit at wald.intevation.org
Wed Jun 26 12:32:11 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372242607 -7200
# Node ID 11d3d04f39258ebe446e09e41912c34fde854bb7
# Parent  654ed1732035bc5df2e20aedfe519a4d165b074d
issue1370: Let a hypothetical second y axis be an SyncNumberAxis depending on first.

diff -r 654ed1732035 -r 11d3d04f3925 artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:28:10 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:30:07 2013 +0200
@@ -65,6 +65,7 @@
     public static final String I18N_MAINVALUES_Q_LABEL = "Q (Haupt- und Extremwerte)";
     public static final String I18N_MAINVALUES_W_LABEL = "W (Haupt- und Extremwerte)";
 
+    protected NumberAxis firstYAxis;
 
     /** Trivial Constructor. */
     public ComputedDischargeCurveGenerator () {
@@ -116,6 +117,36 @@
 
 
     /**
+     * Create Y (range) axis for given index.
+     * Shall be overriden by subclasses.
+     */
+    protected NumberAxis createYAxis(int index) {
+        if (index == 0) {
+            firstYAxis = super.createYAxis(0);
+            return firstYAxis;
+        }
+        YAxisWalker walker = getYAxisWalker();
+
+        Font labelFont = new Font(
+            DEFAULT_FONT_NAME,
+            Font.BOLD,
+            getYAxisFontSize(index));
+
+        SyncNumberAxis axis = new SyncNumberAxis(
+            walker.getId(index),
+            getYAxisLabel(index),
+            firstYAxis);
+
+        axis.setAutoRangeIncludesZero(false);
+        axis.setLabelFont(labelFont);
+        axis.setTickLabelFont(labelFont);
+        axis.setShift((double)-atGaugeSubtractPNP());
+
+        return axis;
+    }
+
+
+    /**
      * Process data, build up plot.
      */
     @Override


More information about the Dive4elements-commits mailing list