[Schmitzm-commits] r985 - in trunk/src/schmitzm/jfree: feature/style table/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 25 13:41:38 CEST 2010


Author: mojays
Date: 2010-08-25 13:41:37 +0200 (Wed, 25 Aug 2010)
New Revision: 985

Modified:
   trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
   trunk/src/schmitzm/jfree/table/style/TableBasicChartStyle.java
   trunk/src/schmitzm/jfree/table/style/TableChartStyle.java
   trunk/src/schmitzm/jfree/table/style/TableScatterChartStyle.java
Log:
New TableChartStyle property to (not) ignore NULL range values, respective treat NULL range values as 0.0.

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-08-25 10:55:58 UTC (rev 984)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-08-25 11:41:37 UTC (rev 985)
@@ -318,8 +318,12 @@
                                                          statisticsForNormalization,
                                                          weightSumsForAggregation);
           // Ignore feature if value is invalid
-          if (yValue == null)
-            continue;
+          if (yValue == null) {
+            if ( chartStyle.isIgnoreNoDataRangeValues() )
+              continue;
+            else
+              yValue = 0.0;
+          }
           
           // determine the dataset according to the axis
           // the attribute should deal with
@@ -745,9 +749,12 @@
                                                          statisticsForNormalization,
                                                          weightSumsForAggregation);
           // Ignore feature if value is invalid
-          if (yValue == null)
-            continue;
-
+          if (yValue == null) {
+            if ( chartStyle.isIgnoreNoDataRangeValues() )
+              continue;
+            else
+              yValue = 0.0;
+          }
           // determine the dataset according to the axis
           // the attribute should deal with
           DefaultCategoryDataset dataset = determineDatasetForAttribute(chartStyle,attrIdx,datasets);
@@ -942,8 +949,12 @@
                                                        statisticsForNormalization,
                                                        weightSumsForAggregation);
         // Ignore feature if value is invalid
-        if (rangeValue == null)
-          continue;
+        if (rangeValue == null) {
+          if ( chartStyle.isIgnoreNoDataRangeValues() )
+            continue;
+          else
+            rangeValue = 0.0;
+        }
 
         // Fill series, if no aggregation function is defined.
         // Otherwise fill statistic (dataset is filled later!)

Modified: trunk/src/schmitzm/jfree/table/style/TableBasicChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/table/style/TableBasicChartStyle.java	2010-08-25 10:55:58 UTC (rev 984)
+++ trunk/src/schmitzm/jfree/table/style/TableBasicChartStyle.java	2010-08-25 11:41:37 UTC (rev 985)
@@ -332,6 +332,30 @@
     }
 
     /**
+     * Sets whether nodata values on the range axes are ignored when creating
+     * the dataset(s). When {@code false}, these values are treat as numeric 0,
+     * which can be result in poor peeks (e.g. in line charts).
+     * For bar charts it can be useful to deal with NULLs as 0.<br>
+     * Default: {@code true}   
+     */
+    @Override
+    public void setIgnoreNoDataRangeValues(boolean ignoreNulls) {
+      dummyTableChartStyle.setIgnoreNoDataRangeValues(ignoreNulls);
+    }
+    
+    /**
+     * Returns whether nodata values on the range axes are ignored when creating
+     * the dataset(s). When {@code false}, these values are treat as numeric 0,
+     * which can be result in poor peeks (e.g. in line charts).
+     * For bar charts it can be useful to deal with NULLs as 0.<br>
+     * Default: {@code true} 
+     */
+    @Override
+    public boolean isIgnoreNoDataRangeValues() {
+      return dummyTableChartStyle.isIgnoreNoDataRangeValues();
+    }
+
+    /**
      * Sets the table attribute the i-th chart attribute is weighted with.<br>
      * <b>Note:</b>
      * <ul>

Modified: trunk/src/schmitzm/jfree/table/style/TableChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/table/style/TableChartStyle.java	2010-08-25 10:55:58 UTC (rev 984)
+++ trunk/src/schmitzm/jfree/table/style/TableChartStyle.java	2010-08-25 11:41:37 UTC (rev 985)
@@ -224,6 +224,7 @@
    */
   public boolean isNoDataValue(int idx, Object value);
 
+
   /**
    * Checks whether the given value is one of the "No data" values for the
    * attribute. In this case this method returns {@code null}, otherwise the
@@ -235,6 +236,24 @@
   public <T> T filterNoDataValue(int idx, T value);
 
   /**
+   * Sets whether nodata values on the range axes are ignored when creating
+   * the dataset(s). When {@code false}, these values are treat as numeric 0,
+   * which can be result in poor peeks (e.g. in line charts).
+   * For bar charts it can be useful to deal with NULLs as 0.  <br>
+   * Default: {@code true} 
+   */
+  public void setIgnoreNoDataRangeValues(boolean ignoreNulls);
+  
+  /**
+   * Returns whether nodata values on the range axes are ignored when creating
+   * the dataset(s). When {@code false}, these values are treat as numeric 0,
+   * which can be result in poor peeks (e.g. in line charts).
+   * For bar charts it can be useful to deal with NULLs as 0.<br>
+   * Default: {@code true}  
+   */
+  public boolean isIgnoreNoDataRangeValues();
+  
+  /**
    * Sets the table attribute the i-th chart attribute is weighted with.<br>
    * <b>Note:</b>
    * <ul>
@@ -447,6 +466,15 @@
     /** Holds the "No Data" values for each attribute. */
     protected Map<Integer, Set<Object>> noDataValues = new HashMap<Integer, Set<Object>>();
 
+    /**
+     * Indicates whether nodata values on the range axes are ignored when creating
+     * the dataset(s). When {@code false}, these values are treat as numeric 0,
+     * which can be result in poor peeks (e.g. in line charts).
+     * For bar charts it can be useful to deal with NULLs as 0.  <br>
+     * Default: {@code true} 
+     */
+    protected boolean ignoreNullRangeValues = true;
+    
     /** Holds the aggregation function for each attribute. */
     protected Map<Integer, AggregationFunction> aggrFuncs = new HashMap<Integer, AggregationFunction>();
 
@@ -894,6 +922,30 @@
     }
 
     /**
+     * Sets whether nodata values on the range axes are ignored when creating
+     * the dataset(s). When {@code false}, these values are treat as numeric 0,
+     * which can be result in poor peeks (e.g. in line charts).
+     * For bar charts it can be useful to deal with NULLs as 0.<br>
+     * Default: {@code true}   
+     */
+    @Override
+    public void setIgnoreNoDataRangeValues(boolean ignoreNulls) {
+      this.ignoreNullRangeValues = ignoreNulls;
+    }
+    
+    /**
+     * Returns whether nodata values on the range axes are ignored when creating
+     * the dataset(s). When {@code false}, these values are treat as numeric 0,
+     * which can be result in poor peeks (e.g. in line charts).
+     * For bar charts it can be useful to deal with NULLs as 0.<br>
+     * Default: {@code true} 
+     */
+    @Override
+    public boolean isIgnoreNoDataRangeValues() {
+      return ignoreNullRangeValues;
+    }
+
+    /**
      * Sets the table attribute the i-th chart attribute is weighted with.<br>
      * <b>Note:</b>
      * <ul>

Modified: trunk/src/schmitzm/jfree/table/style/TableScatterChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/table/style/TableScatterChartStyle.java	2010-08-25 10:55:58 UTC (rev 984)
+++ trunk/src/schmitzm/jfree/table/style/TableScatterChartStyle.java	2010-08-25 11:41:37 UTC (rev 985)
@@ -346,6 +346,31 @@
   }
 
   /**
+   * Sets whether nodata values on the range axes are ignored when creating
+   * the dataset(s). When {@code false}, these values are treat as numeric 0,
+   * which can be result in poor peeks (e.g. in line charts).
+   * For bar charts it can be useful to deal with NULLs as 0.<br>
+   * Default: {@code true}   
+   */
+  @Override
+  public void setIgnoreNoDataRangeValues(boolean ignoreNulls) {
+    dummyTableChartStyle.setIgnoreNoDataRangeValues(ignoreNulls);
+  }
+  
+  /**
+   * Returns whether nodata values on the range axes are ignored when creating
+   * the dataset(s). When {@code false}, these values are treat as numeric 0,
+   * which can be result in poor peeks (e.g. in line charts).
+   * For bar charts it can be useful to deal with NULLs as 0.<br>
+   * Default: {@code true} 
+   */
+  @Override
+  public boolean isIgnoreNoDataRangeValues() {
+    return dummyTableChartStyle.isIgnoreNoDataRangeValues();
+  }
+
+
+  /**
    * Sets the table attribute the i-th chart attribute is weighted with.<br>
    * <b>Note:</b>
    * <ul>



More information about the Schmitzm-commits mailing list