Mercurial > dive4elements > river
changeset 3248:4eb91fb1e73e
Fix weird code with help of new ChartHelper.
flys-artifacts/trunk@4881 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 06 Jul 2012 09:37:24 +0000 |
parents | 638b1da85450 |
children | f76cef888ee1 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Fri Jul 06 09:36:03 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Jul 06 09:37:24 2012 +0000 @@ -1,3 +1,9 @@ +2012-07-07 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/exports/ChartGenerator.java + (expandPointRange): Fix weird code with help of new ChartHelper + method. + 2012-07-07 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/exports/ChartHelper.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Fri Jul 06 09:36:03 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Fri Jul 06 09:37:24 2012 +0000 @@ -1647,17 +1647,17 @@ * Expands a given range if it collapses into one point. * * @param Range to be expanded if upper == lower bound. + * + * @return Bounds of point plus 5 percent in each direction. */ private Bounds expandPointRange(Range range) { if (range == null) { return null; } + // TODO reuse the ChartHelper.expandRange ..! else if (range.getLowerBound() == range.getUpperBound()) { - double hi = range.getUpperBound(); - double lo = range.getLowerBound(); - double add = (hi - lo) / 100 * 5; - - return new DoubleBounds(lo-add, hi+add); + Range expandedRange = ChartHelper.expandRange(range, 5d); + return new DoubleBounds(expandedRange.getLowerBound(), expandedRange.getUpperBound()); } return new DoubleBounds(range.getLowerBound(), range.getUpperBound());