[PATCH] issue1493: Also transform NaN X values to empty string

Wald Commits scm-commit at wald.intevation.org
Wed Sep 25 16:18:04 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1380119303 -7200
# Node ID 491b645123b6a4126110962f476c03dd3151a025
# Parent  dccac2a675db5554d5811a42803bb40d9fbb52c8
issue1493: Also transform NaN X values to empty string.

diff -r dccac2a675db -r 491b645123b6 artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Wed Sep 25 16:01:50 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Wed Sep 25 16:28:23 2013 +0200
@@ -345,10 +345,22 @@
             int items = data.getItemCount(i);
             for (int j = 0; j < items; j++) {
                 log.debug("write data: " + data.getX(i, j) + ", " + data.getY(i, j));
+
+                /*
+                // Skip (NaN,NaN) datapoints.
+                if (java.lang.Double.isNaN(data.getYValue(i,j))
+                    && java.lang.Double.isNaN(data.getXValue(i,j))) {
+                    continue;
+                }
+                */
+
                 String xString;
                 String yString;
+
                 try {
-                    xString = format.format(data.getX(i, j));
+                    xString = java.lang.Double.isNaN(data.getXValue(i,j))
+                        ? ""
+                        : format.format(data.getX(i, j));
                     yString = java.lang.Double.isNaN(data.getYValue(i, j))
                         ? ""
                         : format.format(data.getY(i, j));


More information about the Dive4elements-commits mailing list