comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 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 bbc966c81809
children b22f21b173a7
comparison
equal deleted inserted replaced
666:eb45e05e5c5b 667:434146596838
216 216
217 for (int j = 0; j < iCount; j++) { 217 for (int j = 0; j < iCount; j++) {
218 double x = dataset.getX(i, j).doubleValue(); 218 double x = dataset.getX(i, j).doubleValue();
219 double y = dataset.getY(i, j).doubleValue(); 219 double y = dataset.getY(i, j).doubleValue();
220 220
221 xr[0] = xr[0] < x ? xr[0] : x; 221 if (!Double.isNaN(x)) {
222 xr[1] = xr[1] > x ? xr[1] : x; 222 xr[0] = xr[0] < x ? xr[0] : x;
223 yr[0] = yr[0] < y ? yr[0] : y; 223 xr[1] = xr[1] > x ? xr[1] : x;
224 yr[1] = yr[1] > y ? yr[1] : y; 224 }
225
226 if (!Double.isNaN(y)) {
227 yr[0] = yr[0] < y ? yr[0] : y;
228 yr[1] = yr[1] > y ? yr[1] : y;
229 }
225 } 230 }
226 } 231 }
227 232
228 // this is only required, if there are no items in the dataset. 233 // this is only required, if there are no items in the dataset.
229 xr[0] = xr[0] < xr[1] ? xr[0] : xr[1]; 234 xr[0] = xr[0] < xr[1] ? xr[0] : xr[1];

http://dive4elements.wald.intevation.org