changeset 667:434146596838

Made the chart range determination more robust against NaN values. flys-artifacts/trunk@2081 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 08 Jun 2011 13:03:21 +0000
parents eb45e05e5c5b
children 5523f5b889a8 3dc61e00385e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jun 08 12:35:44 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 08 13:03:21 2011 +0000
@@ -1,3 +1,8 @@
+2011-06-08  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  Made the range determination more robust against NaN values.
+
 2011-06-08  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Jun 08 12:35:44 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Jun 08 13:03:21 2011 +0000
@@ -218,10 +218,15 @@
                 double x = dataset.getX(i, j).doubleValue();
                 double y = dataset.getY(i, j).doubleValue();
 
-                xr[0] = xr[0] < x ? xr[0] : x;
-                xr[1] = xr[1] > x ? xr[1] : x;
-                yr[0] = yr[0] < y ? yr[0] : y;
-                yr[1] = yr[1] > y ? yr[1] : y;
+                if (!Double.isNaN(x)) {
+                    xr[0] = xr[0] < x ? xr[0] : x;
+                    xr[1] = xr[1] > x ? xr[1] : x;
+                }
+
+                if (!Double.isNaN(y)) {
+                    yr[0] = yr[0] < y ? yr[0] : y;
+                    yr[1] = yr[1] > y ? yr[1] : y;
+                }
             }
         }
 

http://dive4elements.wald.intevation.org