# HG changeset patch # User Felix Wolfsteller # Date 1322491126 0 # Node ID 0fa53fa6540185d9199f3113dc46d094fcb75b8f # Parent 0d12e70766c84a0b49823d88f11a4589a2585bd3 Fix LongitudinalSections multi-axes plotting behavior. flys-artifacts/trunk@3322 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0d12e70766c8 -r 0fa53fa65401 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Nov 28 14:36:56 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Nov 28 14:38:46 2011 +0000 @@ -1,3 +1,11 @@ +2011-11-28 Felix Wolfsteller + + Fix LongitudinalSections multi-axes plotting behavior. + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + Removed obsolete functions, use better working multi-axis + magic by XYChartGenerator. + 2011-11-28 Felix Wolfsteller Overhaul dataset/axis/renderer housekeeping in Mother of all diff -r 0d12e70766c8 -r 0fa53fa65401 flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon Nov 28 14:36:56 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon Nov 28 14:38:46 2011 +0000 @@ -189,6 +189,13 @@ label = "TODO: diff"; } NumberAxis axis = new NumberAxis(label); + // "Q" Axis shall include 0. + if (index == YAXIS.Q.idx) { + axis.setAutoRangeIncludesZero(true); + } + else { + axis.setAutoRangeIncludesZero(false); + } axis.setLabelFont(labelFont); return axis; } @@ -221,34 +228,6 @@ /** - * Create a range that includes 0 (for the Q axis). - * @param range range with which to look up upper bound. - * @return range with 0 included. - */ - protected Range createSecondAxisRange(Range range) { - if (range == null) { - return null; - } - return new Range(0d, range.getUpperBound()); - } - - - /** - * This method overrides the XYChartGenerators zoomY method to be able to - * modify the range of the Q axis (here, it shall include 0). - */ - @Override - protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { - if (plot.getRangeAxisIndex(axis) == 1) { - // We want the Q axis to start at 0 if no zooming has been done. - range = createSecondAxisRange(range); - } - - return super.zoomY(plot, axis, range, x); - } - - - /** * This method inverts the x-axis based on the kilometer information of the * selected river. If the head of the river is at kilometer 0, the axis is * not inverted, otherwise it is.