[gnumeric] Force sharing of first series in line plots when requested. [#605330]



commit 79489f5ad02f044b470d0438a51bd65efcd488a2
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Dec 24 07:23:23 2009 +0100

    Force sharing of first series in line plots when requested. [#605330]

 ChangeLog                        |    7 +++++++
 NEWS                             |    1 +
 plugins/fn-tsa/ChangeLog         |    8 ++++++++
 plugins/fn-tsa/functions.c       |   26 +++++++++++++-------------
 src/dialogs/ChangeLog            |    4 ++++
 src/dialogs/dialog-preferences.c |    2 +-
 src/rangefunc.h                  |    2 ++
 src/selection.c                  |    3 ++-
 8 files changed, 38 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b36a6f3..b3837b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-24  Jean Brefort  <jean brefort normalesup org>
+
+	* src/rangefunc.h: add gnm_range_increasing (to fix a double/gnm_float
+	issue).
+	* src/selection.c (sv_selection_to_plot): force sharing of first series
+	as labels for line plots and friends when requested. [#605330]
+
 2009-12-23  Morten Welinder  <terra gnome org>
 
 	* src/gnm-datetime.c (datetime_value_to_serial): Fix type problem.
diff --git a/NEWS b/NEWS
index ae29726..91690e1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Andreas:
 
 Jean
 	* Fix import export of line type in scatter plots. [#605043]
+	* Force sharing of first series in line plots when requested. [#605330]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.17
diff --git a/plugins/fn-tsa/ChangeLog b/plugins/fn-tsa/ChangeLog
index c5e34b3..5634e7e 100644
--- a/plugins/fn-tsa/ChangeLog
+++ b/plugins/fn-tsa/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-24  Jean Brefort  <jean brefort normalesup org>
+
+	* functions.c (linear_interpolation), (linear_averaging),
+	(staircase_interpolation), (staircase_averaging),
+	(spline_interpolation), (spline_averaging),
+	(gnumeric_interpolation), (gnumeric_periodogram): fixed double/gnm_float
+	issues.
+
 2009-12-15  Morten Welinder <terra gnome org>
 
 	* Release 1.9.17
diff --git a/plugins/fn-tsa/functions.c b/plugins/fn-tsa/functions.c
index 34d1323..d1e2604 100644
--- a/plugins/fn-tsa/functions.c
+++ b/plugins/fn-tsa/functions.c
@@ -152,8 +152,8 @@ linear_interpolation (const gnm_float *absc, const gnm_float *ord, int nb_knots,
 	gnm_float slope, *res;
 	if (nb_knots < 2)
 		return NULL;
-	res = g_new (double, nb_targets);
-	if (go_range_increasing (targets, nb_targets)) {
+	res = g_new (gnm_float, nb_targets);
+	if (gnm_range_increasing (targets, nb_targets)) {
 		j = 1;
 		k = 0;
 		slope = (ord[1] - ord[0]) / (absc[1] - absc[0]);
@@ -204,9 +204,9 @@ linear_averaging (const gnm_float *absc, const gnm_float *ord, int nb_knots,
 {
 	int i, j, k, jmax = nb_knots - 1;
 	gnm_float slope, *res, x0, x1;
-	if (nb_knots < 2 || !go_range_increasing (targets, nb_targets))
+	if (nb_knots < 2 || !gnm_range_increasing (targets, nb_targets))
 		return NULL;
-	res = g_new (double, nb_targets - 1);
+	res = g_new (gnm_float, nb_targets - 1);
 	j = 1;
 	while (j < jmax && targets[0] > absc[j])
 		j++;
@@ -250,8 +250,8 @@ staircase_interpolation (const gnm_float *absc, const gnm_float *ord, int nb_kno
 {
 	int i, j, jmax = nb_knots - 1;
 	gnm_float *res;
-	res = g_new (double, nb_targets);
-	if (go_range_increasing (targets, nb_targets)) {
+	res = g_new (gnm_float, nb_targets);
+	if (gnm_range_increasing (targets, nb_targets)) {
 		j = 1;
 		for (i = 0; i < nb_targets; i++) {
 			while (j <= jmax && targets[i] >= absc[j])
@@ -290,9 +290,9 @@ staircase_averaging (const gnm_float *absc, const gnm_float *ord, int nb_knots,
 {
 	int i, j, jmax = nb_knots - 1;
 	gnm_float *res;
-	if (!go_range_increasing (targets, nb_targets))
+	if (!gnm_range_increasing (targets, nb_targets))
 		return NULL;
-	res = g_new (double, nb_targets - 1);
+	res = g_new (gnm_float, nb_targets - 1);
 	j = 1;
 	while (j <= jmax && targets[0] >= absc[j])
 		j++;
@@ -324,10 +324,10 @@ spline_interpolation (const gnm_float *absc, const gnm_float *ord, int nb_knots,
 					   GO_CSPLINE_NATURAL, 0., 0.);
 	if (!sp)
 		return NULL;
-	if (go_range_increasing (targets, nb_targets))
+	if (gnm_range_increasing (targets, nb_targets))
 		res = gnm_cspline_get_values (sp, targets, nb_targets);
 	else {
-		res = g_new (double, nb_targets);
+		res = g_new (gnm_float, nb_targets);
 		for (i = 0; i < nb_targets; i++)
 			res[i] = gnm_cspline_get_value (sp, targets[i]);
 	}
@@ -344,7 +344,7 @@ spline_averaging (const gnm_float *absc, const gnm_float *ord, int nb_knots,
 	gnm_float *res;
 	int i, imax;
 	GnmCSpline *sp;
-	if (!go_range_increasing (targets, nb_targets))
+	if (!gnm_range_increasing (targets, nb_targets))
 		return NULL;
 	sp = gnm_cspline_init (absc, ord, nb_knots,
 			       GO_CSPLINE_NATURAL, 0., 0.);
@@ -591,7 +591,7 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 		/* here we test if there is abscissas are always increasing, if not,
 		   an error is returned */
-		if (!go_range_increasing (vals0, n0) || n2==0) {
+		if (!gnm_range_increasing (vals0, n0) || n2==0) {
 			res = value_new_error_std (ei->pos, GNM_ERROR_VALUE);
 			for (i = 0; i < nb; i++)
 				value_release (values[i]);
@@ -773,7 +773,7 @@ gnumeric_periodogram (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 		}
 		/* here we test if there is abscissas are always increasing, if not,
 		   an error is returned */
-		if (!go_range_increasing (absc, n0) || n0 == 0) {
+		if (!gnm_range_increasing (absc, n0) || n0 == 0) {
 			g_free (absc);
 			g_free (ord);
 			return value_new_error_std (ei->pos, GNM_ERROR_VALUE);
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 07dd2fa..0615e6d 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,7 @@
+2009-12-24  Jean Brefort  <jean brefort normalesup org>
+
+	* dialog-preferences.c: Fixed double/gnm_float issues.
+
 2009-12-22 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-analysis-tool-principal-components.c: new
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 224f6b0..d788fe3 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -66,7 +66,7 @@ typedef struct {
 	gulong          app_wb_removed_sig;
 } PrefState;
 
-typedef void (* double_conf_setter_t) (gnm_float value);
+typedef void (* double_conf_setter_t) (double value);
 typedef void (* gint_conf_setter_t) (gint value);
 typedef void (* gboolean_conf_setter_t) (gboolean value);
 typedef void (* enum_conf_setter_t) (int value);
diff --git a/src/rangefunc.h b/src/rangefunc.h
index 514d46e..f761df3 100644
--- a/src/rangefunc.h
+++ b/src/rangefunc.h
@@ -18,6 +18,7 @@ G_BEGIN_DECLS
 #	define gnm_range_fractile_inter_sorted go_range_fractile_inter_sortedl
 #	define gnm_range_median_inter go_range_median_interl
 #	define gnm_range_median_inter_sorted go_range_median_inter_sortedl
+#       define gnm_range_increasing go_range_increasingl
 #else
 #	define gnm_range_sum go_range_sum
 #	define gnm_range_sumsq go_range_sumsq
@@ -29,6 +30,7 @@ G_BEGIN_DECLS
 #	define gnm_range_fractile_inter_sorted go_range_fractile_inter_sorted
 #	define gnm_range_median_inter go_range_median_inter
 #	define gnm_range_median_inter_sorted go_range_median_inter_sorted
+#       define gnm_range_increasing go_range_increasingl
 #endif
 
 int gnm_range_count		(gnm_float const *xs, int n, gnm_float *res);
diff --git a/src/selection.c b/src/selection.c
index e31abeb..6fc6a19 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -1504,7 +1504,8 @@ sv_selection_to_plot (SheetView *sv, GogPlot *go_plot)
 
 			is_string_vec = characterize_vec (sheet, &vector, as_cols,
 				desc->series.dim[cur_dim].val_type == GOG_DIM_LABEL);
-			while ((desc->series.dim[cur_dim].val_type == GOG_DIM_LABEL && !is_string_vec) ||
+			while ((desc->series.dim[cur_dim].val_type == GOG_DIM_LABEL && !is_string_vec
+				&& (!first_series || !data->share_x)) ||
 			       (desc->series.dim[cur_dim].val_type == GOG_DIM_VALUE && is_string_vec)) {
 				if (desc->series.dim[cur_dim].priority == GOG_SERIES_REQUIRED)
 					goto skip;



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