[Schmitzm-commits] r1545 - in trunk/schmitzm-jfree/src/main: java/de/schmitzm/jfree resources/de/schmitzm/jfree/resource/locales

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 31 17:51:57 CEST 2011


Author: alfonx
Date: 2011-03-31 17:51:56 +0200 (Thu, 31 Mar 2011)
New Revision: 1545

Modified:
   trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/JFreeChartUtil.java
   trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties
   trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties
Log:
Besserer Umgang der Regressionsanzeige im Scatterpplot bei sinnlosen Daten (r = NaN)

Modified: trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/JFreeChartUtil.java
===================================================================
--- trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/JFreeChartUtil.java	2011-03-31 08:26:11 UTC (rev 1544)
+++ trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/JFreeChartUtil.java	2011-03-31 15:51:56 UTC (rev 1545)
@@ -1190,11 +1190,16 @@
 	 * medium, strong, ...) according to LAUX.
 	 */
 	public static String getRQuality(double r) {
+		if (Double.isNaN(r))
+			return RESOURCE.getString("regression.notPossible");
+			
 	    double rAbs = Math.abs(r);
 	    // Depending on the quality of the regression, we add a note
 	    // (c) LAUX
 	    String qualityKey = "";
 	    String negativeKeySuffix = r < 0 ? ".neg" : "";
+	    
+	    
 	    if (rAbs < 0.01) {
 	      qualityKey = "regression.none";
 	    } else if (rAbs < 0.5) {
@@ -1257,6 +1262,9 @@
 	public static void addRegressionInfoToPlot(XYPlot plot, RegressionDataset regressionData) {
       DecimalFormat formatter = new DecimalFormat("0.000");
       
+		if (Double.isNaN(regressionData.getR()))
+			return;
+
       // Container which hold the title and text
       BlockContainer container = new BlockContainer( new ColumnArrangement() );
       

Modified: trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties
===================================================================
--- trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties	2011-03-31 08:26:11 UTC (rev 1544)
+++ trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties	2011-03-31 15:51:56 UTC (rev 1545)
@@ -79,6 +79,7 @@
 AggregationFunction.STND_DEV.Desc=Standard deviation of the attribute values
 
 regressionline=regression line
+regression.notPossible=data invalid
 regression.none=no relation
 regression.weak=weak relation
 regression.medium=medium relation
@@ -97,7 +98,7 @@
 regressionInfo.data.r=r
 regressionInfo.data.r.tooltip=<html><i>r</i> = ${0}<br>is the product-moment-correlation coefficient and gives information about how strong the variables are related.</html>
 regressionInfo.data.n=n
-regressionInfo.data.n.tooltip=<html><i>n</i> = ${0}<br>is the number of samples in the regression</html> 
+regressionInfo.data.n.tooltip=<html><i>n</i> \= ${0}<br>is the number of samples in the regression</html> 
 regressionInfo.data.formula=Formula (ax + b)
 regressionInfo.data.formula.tooltip=<html><i>ax + b</i> is the formula of the regression line with<br>Slope <i>a</i> = ${0}<br>Intercept <i>b</i> = ${1}</html>
 

Modified: trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties
===================================================================
--- trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties	2011-03-31 08:26:11 UTC (rev 1544)
+++ trunk/schmitzm-jfree/src/main/resources/de/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties	2011-03-31 15:51:56 UTC (rev 1545)
@@ -82,6 +82,7 @@
 AggregationFunction.NONE.Desc=<html>Fallen mehrere Features in die gleiche Kategorie, wird nur der <i>letzte</i> Wert dargestellt.</html>  
 
 regressionline=Regressionsgerade
+regression.notPossible=nicht berechenbar
 regression.none=kein Zusammenhang
 regression.weak=schwacher Zusammenhang
 regression.medium=mittlerer Zusammenhang
@@ -98,7 +99,7 @@
 
 regressionInfo.title=Regressions-Daten
 regressionInfo.data.r=r
-regressionInfo.data.r.tooltip=<html><i>r</i> = ${0}<br>ist der Produktmomentkorrelationskoefizient und sagt aus, wie stark zwei Variablen voneinander abh\u00E4ngen. 
+regressionInfo.data.r.tooltip=<html><i>r</i> \= ${0}<br>ist der Produktmomentkorrelationskoefizient und sagt aus, wie stark zwei Variablen voneinander abh\u00E4ngen. 
 regressionInfo.data.n=n
 regressionInfo.data.n.tooltip=<html><i>n</i> = ${0}<br>ist die Anzahl der Wertepaare in der Regression</html>
 regressionInfo.data.formula=Formel (ax + b)



More information about the Schmitzm-commits mailing list