goffice r2053 - in trunk: . plugins/plot_boxes



Author: jbrefort
Date: Thu Apr 10 07:01:14 2008
New Revision: 2053
URL: http://svn.gnome.org/viewvc/goffice?rev=2053&view=rev

Log:
2008-04-10  Jean Brefort  <jean brefort normalesup org>

	* plugins/plot_boxes/gog-boxplot.c: skip invalid data. [#527249]



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/plugins/plot_boxes/gog-boxplot.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Apr 10 07:01:14 2008
@@ -1,5 +1,8 @@
 goffice 0.6.3:
 
+Jean:
+	* Don't try to use invalide data in box-plots. [#527249]
+
 Morten:
 	* Add go_format_is_invalid.
 

Modified: trunk/plugins/plot_boxes/gog-boxplot.c
==============================================================================
--- trunk/plugins/plot_boxes/gog-boxplot.c	(original)
+++ trunk/plugins/plot_boxes/gog-boxplot.c	Thu Apr 10 07:01:14 2008
@@ -30,6 +30,7 @@
 #include <goffice/graph/gog-chart-map.h>
 #include <goffice/data/go-data-simple.h>
 #include <goffice/math/go-rangefunc.h>
+#include <goffice/math/go-math.h>
 #include <goffice/app/module-plugin-defs.h>
 
 #include <glib/gi18n-lib.h>
@@ -498,11 +499,13 @@
 	series->base.num_elements = len;
 	if (len > 0) {
 		double *svals = g_new (double, len), x;
-		int n;
-		memcpy (svals, vals, len * sizeof (double));
-		go_range_fractile_inter_nonconst (svals, len, &series->vals[0], 0);
+		int n, max = 0;
+		for (n = 0; n < len; n++)
+			if (go_finite (vals[n]))
+				svals[max++] = vals[n];
+		go_range_fractile_inter_nonconst (svals, max, &series->vals[0], 0);
 		for (x = 0.25,n = 1; n < 5; n++, x+= 0.25)
-			go_range_fractile_inter_sorted (svals, len, &series->vals[n], x);
+			go_range_fractile_inter_sorted (svals, max, &series->vals[n], x);
 		g_free (svals);
 	}
 	/* queue plot for redraw */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]