Mercurial > dive4elements > river
changeset 6424:11d3d04f3925
issue1370: Let a hypothetical second y axis be an SyncNumberAxis depending on first.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 26 Jun 2013 12:30:07 +0200 (2013-06-26) |
parents | 654ed1732035 |
children | 2a2d35299c01 |
files | artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java |
diffstat | 1 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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