[goffice] Use GOData API for graphs, instead of GODataFoo.



commit 657ad5b5462135f066e69f115a0bc3ceeb9ee46e
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date:   Tue Apr 21 15:07:42 2009 +0200

    Use GOData API for graphs, instead of GODataFoo.
    
    This allows to use a polymorph GOData based class instead of
    GODataScalar, GODataVector and GOMatrix based class.
---
 goffice/data/go-data-impl.h                 |    1 +
 goffice/data/goffice-data.h                 |    2 +-
 goffice/graph/gog-axis-line.c               |    4 +-
 goffice/graph/gog-axis.c                    |   16 +++---
 goffice/graph/gog-data-set.c                |    2 +
 goffice/graph/gog-error-bar.c               |   24 +++++-----
 goffice/graph/gog-label.c                   |    2 +-
 goffice/graph/gog-plot.c                    |    9 ++--
 goffice/graph/gog-reg-curve.c               |    6 +--
 goffice/graph/gog-series.c                  |   22 +++++-----
 goffice/graph/gog-series.h                  |    2 +-
 plugins/plot_barcol/gog-1.5d.c              |   22 +++------
 plugins/plot_barcol/gog-barcol.c            |   12 ++---
 plugins/plot_barcol/gog-dropbar.c           |   12 ++---
 plugins/plot_barcol/gog-line.c              |    8 +--
 plugins/plot_barcol/gog-minmax.c            |   12 ++---
 plugins/plot_distrib/gog-boxplot.c          |   23 +++++-----
 plugins/plot_distrib/gog-histogram.c        |   28 +++++-------
 plugins/plot_distrib/gog-probability-plot.c |    9 ++--
 plugins/plot_pie/gog-pie.c                  |    9 ++--
 plugins/plot_radar/gog-radar.c              |   17 +++----
 plugins/plot_surface/gog-contour.c          |   22 +++++-----
 plugins/plot_surface/gog-surface.c          |   14 +++---
 plugins/plot_surface/gog-xyz-surface.c      |   15 +++----
 plugins/plot_surface/gog-xyz.c              |   64 ++++++++++++--------------
 plugins/plot_surface/gog-xyz.h              |   14 +++---
 plugins/plot_surface/xl-surface.c           |   48 +++++++++-----------
 plugins/plot_xy/gog-xy.c                    |   21 +++-----
 plugins/smoothing/gog-exp-smooth.c          |    5 +-
 29 files changed, 199 insertions(+), 246 deletions(-)

diff --git a/goffice/data/go-data-impl.h b/goffice/data/go-data-impl.h
index bf96ba7..2fb02a7 100644
--- a/goffice/data/go-data-impl.h
+++ b/goffice/data/go-data-impl.h
@@ -37,6 +37,7 @@ struct _GOData {
 	GObject		base;
 	gint32		flags; /* dunno what to do with these yet */
 };
+
 typedef struct {
 	GObjectClass base;
 
diff --git a/goffice/data/goffice-data.h b/goffice/data/goffice-data.h
index b13ef0d..f4f1ebe 100644
--- a/goffice/data/goffice-data.h
+++ b/goffice/data/goffice-data.h
@@ -26,8 +26,8 @@
 
 G_BEGIN_DECLS
 
-/* Data */
 typedef struct _GOData		 GOData;
+
 typedef struct _GODataScalar	 GODataScalar;
 typedef struct _GODataVector	 GODataVector;
 typedef struct _GODataMatrix	 GODataMatrix;
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index 91b94de..9aac5c7 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -771,8 +771,8 @@ gog_axis_base_get_cross_location (GogAxisBase *axis_base)
 	g_return_val_if_fail (GOG_AXIS_BASE (axis_base) != NULL, 0.);
 
 	data = axis_base->cross_location.data;
-	if (data != NULL && GO_IS_DATA_SCALAR (data))
-		return go_data_scalar_get_value (GO_DATA_SCALAR (data));
+	if (GO_IS_DATA (data))
+		return go_data_get_scalar_value (data);
 
 	return 0.;
 }
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index ee3dacd..0707c6b 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -92,7 +92,7 @@ struct _GogAxis {
 	gpointer	min_contrib, max_contrib; /* NULL means use the manual sources */
 	gboolean	is_discrete;
 	gboolean	center_on_ticks;
-	GODataVector   *labels;
+	GOData         *labels;
 	GogPlot	       *plot_that_supplied_labels;
 	GOFormat       *format, *assigned_format;
 
@@ -335,8 +335,8 @@ map_discrete_calc_ticks (GogAxis *axis)
 		index = ticks[j].position - 1;
 		ticks[j].type = GOG_AXIS_TICK_NONE;
 		if (axis->labels != NULL) {
-			if (index < go_data_vector_get_len (axis->labels) && index >= 0) {
-				char *label = go_data_vector_get_str (axis->labels, index);
+			if (index < (int) go_data_get_vector_size (axis->labels) && index >= 0) {
+				char *label = go_data_get_vector_string (axis->labels, index);
 				ticks[j].label = g_markup_escape_text (label, -1);
 				g_free (label);
 			} else
@@ -1865,8 +1865,8 @@ gog_axis_get_entry (GogAxis const *axis, GogAxisElemType i, gboolean *user_defin
 	else
 		dat = GOG_AXIS_BASE (axis)->cross_location.data;
 
-	if (dat != NULL && GO_IS_DATA_SCALAR (dat)) {
-		double tmp = go_data_scalar_get_value (GO_DATA_SCALAR (dat));
+	if (GO_IS_DATA (dat)) {
+		double tmp = go_data_get_scalar_value (dat);
 		if (go_finite (tmp)) {
 			if (user_defined)
 				*user_defined = TRUE;
@@ -1920,7 +1920,7 @@ gog_axis_update (GogObject *obj)
 			axis->is_discrete = FALSE;
 		else if (axis->labels == NULL && labels != NULL) {
 			g_object_ref (labels);
-			axis->labels = GO_DATA_VECTOR (labels);
+			axis->labels = labels;
 			axis->plot_that_supplied_labels = GOG_PLOT (ptr->data);
 		}
 		axis->center_on_ticks = bounds.center_on_ticks;
@@ -2497,11 +2497,11 @@ gog_axis_set_bounds (GogAxis *axis, double minimum, double maximum)
 
 	if (go_finite (minimum)) {
 		gog_dataset_set_dim (GOG_DATASET (axis), GOG_AXIS_ELEM_MIN,
-				     go_data_scalar_val_new (minimum), NULL);
+				     GO_DATA (go_data_scalar_val_new (minimum)), NULL);
 	}
 	if (go_finite (maximum)) {
 		gog_dataset_set_dim (GOG_DATASET (axis), GOG_AXIS_ELEM_MAX,
-				     go_data_scalar_val_new (maximum), NULL);
+				     GO_DATA (go_data_scalar_val_new (maximum)), NULL);
 	}
 }
 
diff --git a/goffice/graph/gog-data-set.c b/goffice/graph/gog-data-set.c
index c917c9d..8795408 100644
--- a/goffice/graph/gog-data-set.c
+++ b/goffice/graph/gog-data-set.c
@@ -226,6 +226,7 @@ gog_dataset_parent_changed (GogDataset *set, gboolean was_set)
 void
 gog_dataset_dup_to_simple (GogDataset const *src, GogDataset *dst)
 {
+#if 0
 	gint	     n, last;
 	GOData *src_dat, *dst_dat;
 	gog_dataset_dims (src, &n, &last);
@@ -272,4 +273,5 @@ gog_dataset_dup_to_simple (GogDataset const *src, GogDataset *dst)
 		}
 		gog_dataset_set_dim (dst, n, dst_dat, NULL);
 	}
+#endif
 }
diff --git a/goffice/graph/gog-error-bar.c b/goffice/graph/gog-error-bar.c
index a046a1f..ca85f88 100644
--- a/goffice/graph/gog-error-bar.c
+++ b/goffice/graph/gog-error-bar.c
@@ -500,7 +500,7 @@ gog_error_bar_get_bounds (GogErrorBar const *bar, int index, double *min, double
 {
 	double value;
 	GOData *data;
-	GODataVector *vec;
+	GOData *vec;
 	int length;
 
 	/* -1 ensures that the bar will not be displayed if the error is not a correct one.
@@ -510,29 +510,29 @@ gog_error_bar_get_bounds (GogErrorBar const *bar, int index, double *min, double
 	g_return_val_if_fail (GOG_IS_ERROR_BAR (bar), FALSE);
 	if (!gog_series_is_valid (bar->series))
 		return FALSE;
-	vec = GO_DATA_VECTOR (bar->series->values[bar->dim_i].data);
+	vec = bar->series->values[bar->dim_i].data;
 	if (vec == NULL || index < 0)
 		return FALSE;
-	value = go_data_vector_get_value (vec, index);
+	value = go_data_get_vector_value (vec, index);
 	data = bar->series->values[bar->error_i].data;
-	length = (GO_IS_DATA (data)) ? go_data_vector_get_len (GO_DATA_VECTOR (data)) : 0;
+	length = (GO_IS_DATA (data)) ? go_data_get_vector_size (data) : 0;
 
 	if ((bar->type == GOG_ERROR_BAR_TYPE_NONE) || isnan (value) || !go_finite (value))
 		return FALSE;
 
 	if (length == 1)
-		*max = go_data_vector_get_value (GO_DATA_VECTOR (data), 0);
+		*max = go_data_get_vector_value (data, 0);
 	else if (length > index)
-		*max = go_data_vector_get_value (GO_DATA_VECTOR (data), index);
+		*max = go_data_get_vector_value (data, index);
 
 	data = bar->series->values[bar->error_i + 1].data;
-	length = (GO_IS_DATA (data))? go_data_vector_get_len (GO_DATA_VECTOR (data)): 0;
+	length = (GO_IS_DATA (data))? go_data_get_vector_size (data): 0;
 	if (length == 0)
 		*min = *max; /* use same values for + and - */
 	else if (length == 1)
-		*min = go_data_vector_get_value (GO_DATA_VECTOR (data), 0);
+		*min = go_data_get_vector_value (data, 0);
 	else if (length > index)
-		*min = go_data_vector_get_value (GO_DATA_VECTOR (data), index);
+		*min = go_data_get_vector_value (data, index);
 
 	if (isnan (*min) || !go_finite (*min) || (*min <= 0)) {
 		*min = -1.;
@@ -572,11 +572,11 @@ gog_error_bar_get_minmax (const GogErrorBar *bar, double *min, double *max)
 		return;
 	}
 
-	imax = go_data_vector_get_len (GO_DATA_VECTOR (bar->series->values[bar->dim_i].data));
+	imax = go_data_get_vector_size (bar->series->values[bar->dim_i].data);
 	if (imax == 0)
 		return;
-	go_data_vector_get_minmax (GO_DATA_VECTOR (bar->series->values[bar->dim_i].data), min, max);
-	values = go_data_vector_get_values (GO_DATA_VECTOR (bar->series->values[bar->dim_i].data));
+	go_data_get_bounds (bar->series->values[bar->dim_i].data, min, max);
+	values = go_data_get_values (bar->series->values[bar->dim_i].data);
 
 	for (i = 0; i < imax; i++) {
 		if  (gog_error_bar_get_bounds (bar, i, &minus, &plus)) {
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index d689ddd..7b9f256 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -220,7 +220,7 @@ gog_label_get_str (GogText *text)
 	g_return_val_if_fail (GOG_IS_LABEL (label), NULL);
 
 	if (label->text.data != NULL)
-		return g_strdup (go_data_scalar_get_str (GO_DATA_SCALAR (label->text.data)));
+		return go_data_get_scalar_string (label->text.data);
 	
 	return NULL;
 }
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index aa6f8aa..9f6e359 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -713,7 +713,7 @@ gog_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
 	GSList *ptr;
 	GogSeries const *series;
 	GOStyle *style, *tmp_style;
-	GODataVector *labels;
+	GOData *labels;
 	unsigned i, n, num_labels = 0;
 	char *label = NULL;
 	GogTheme *theme = gog_object_get_theme (GOG_OBJECT (plot));
@@ -756,8 +756,8 @@ gog_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
 	series = ptr->data; /* start with the first */
 	labels = NULL;
 	if (series->values[0].data != NULL) {
-		labels = GO_DATA_VECTOR (series->values[0].data);
-		num_labels = go_data_vector_get_len (labels);
+		labels = series->values[0].data;
+		num_labels = go_data_get_vector_size (labels);
 	}
 	style = go_style_dup (series->base.style);
 	n = only_visible ? plot->visible_cardinality : plot->full_cardinality;
@@ -772,8 +772,7 @@ gog_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
 		gog_theme_fillin_style (theme, tmp_style, GOG_OBJECT (series),
 			plot->index_num + i, FALSE);
 		if (labels != NULL)
- 			label = (i < num_labels)
- 				? go_data_vector_get_str (labels, i) : g_strdup ("");
+			label = (i < num_labels) ? go_data_get_vector_string (labels, i) : g_strdup ("");
 		else
 			label = NULL;
 		if (label == NULL)
diff --git a/goffice/graph/gog-reg-curve.c b/goffice/graph/gog-reg-curve.c
index 2571007..e40e21d 100644
--- a/goffice/graph/gog-reg-curve.c
+++ b/goffice/graph/gog-reg-curve.c
@@ -262,15 +262,13 @@ void
 gog_reg_curve_get_bounds (GogRegCurve *reg_curve, double *xmin, double *xmax)
 {
 	if (reg_curve->bounds[0].data) {
-		*xmin = go_data_scalar_get_value (
-			GO_DATA_SCALAR (reg_curve->bounds[0].data));
+		*xmin = go_data_get_scalar_value (reg_curve->bounds[0].data);
 		if (*xmin == go_nan || !go_finite (*xmin))
 			*xmin = -DBL_MAX;
 	} else
 		*xmin = -DBL_MAX;
 	if (reg_curve->bounds[1].data) {
-		*xmax = go_data_scalar_get_value (
-			GO_DATA_SCALAR (reg_curve->bounds[1].data));
+		*xmax = go_data_get_scalar_value (reg_curve->bounds[1].data);
 		if (*xmax == go_nan || !go_finite (*xmax))
 			*xmax = DBL_MAX;
 	} else
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index 516b858..15a14a3 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -753,8 +753,7 @@ gog_series_dataset_set_dim (GogDataset *set, int dim_i,
 	if (dim_i < 0) {
 		char *name = NULL;
 		if (NULL != series->values[-1].data)
-			name = g_strdup (go_data_scalar_get_str (
-				GO_DATA_SCALAR (series->values[-1].data)));
+			name = go_data_get_scalar_string (series->values[-1].data);
 		gog_object_set_name (GOG_OBJECT (series), name, err);
 		return;
 	}
@@ -805,9 +804,9 @@ gog_series_dataset_dim_changed (GogDataset *set, int dim_i)
 		gog_object_request_update (GOG_OBJECT (set));
 	} else {
 		GOData *name_src = series->values[-1].data;
-		char const *name = (name_src != NULL)
-			? go_data_scalar_get_str (GO_DATA_SCALAR (name_src)) : NULL;
-		gog_object_set_name (GOG_OBJECT (set), g_strdup (name), NULL);
+		char *name = (name_src != NULL)
+			? go_data_get_scalar_string (name_src) : NULL;
+		gog_object_set_name (GOG_OBJECT (set), name, NULL);
 	}
 }
 
@@ -934,11 +933,12 @@ gog_series_set_index (GogSeries *series, int ind, gboolean is_manual)
  *
  * return value: a #GODataScalar, without added reference.
  **/
-GODataScalar *
+GOData *
 gog_series_get_name (GogSeries const *series)
 {
 	g_return_val_if_fail (GOG_IS_SERIES (series), NULL);
-	return GO_DATA_SCALAR (series->values[-1].data);
+
+	return series->values[-1].data;
 }
 
 /**
@@ -1045,7 +1045,7 @@ gog_series_get_element (GogSeries const *series, int index)
 static unsigned int
 gog_series_get_data (GogSeries const *series, int *indices, double **data, int n_vectors)
 {
-	GODataVector *vector;
+	GOData *vector;
 	int i, n_points = 0, vector_n_points;
 	int first, last;
 	int index;
@@ -1059,9 +1059,9 @@ gog_series_get_data (GogSeries const *series, int *indices, double **data, int n
 	for (i = 0; i < n_vectors; i++) {
 		index = indices != NULL ? indices[i] : i;
 		if (index >= first && index <= last &&
-		    (vector = GO_DATA_VECTOR (series->values[index].data)) != NULL) {
-			data[i] = go_data_vector_get_values (vector);
-			vector_n_points = go_data_vector_get_len (vector);
+		    (vector = series->values[index].data) != NULL) {
+			data[i] = go_data_get_values (vector);
+			vector_n_points = go_data_get_vector_size (vector);
 			if (!is_set) {
 				is_set = TRUE;
 				n_points = vector_n_points;
diff --git a/goffice/graph/gog-series.h b/goffice/graph/gog-series.h
index 634acc2..c70b1c8 100644
--- a/goffice/graph/gog-series.h
+++ b/goffice/graph/gog-series.h
@@ -55,7 +55,7 @@ GType gog_series_element_get_type (void);
 GType gog_series_get_type (void);
 gboolean      gog_series_is_valid   (GogSeries const *series);
 gboolean      gog_series_has_legend (GogSeries const *series);
-GODataScalar *gog_series_get_name   (GogSeries const *series);
+GOData       *gog_series_get_name   (GogSeries const *series);
 GogPlot	     *gog_series_get_plot   (GogSeries const *series);
 void	      gog_series_set_name   (GogSeries *series,
 				     GODataScalar *name_src, GError **err);
diff --git a/plugins/plot_barcol/gog-1.5d.c b/plugins/plot_barcol/gog-1.5d.c
index 533e8aa..9472858 100644
--- a/plugins/plot_barcol/gog-1.5d.c
+++ b/plugins/plot_barcol/gog-1.5d.c
@@ -189,12 +189,10 @@ gog_plot1_5d_update (GogObject *obj)
 			if (gog_error_bar_is_visible (series->errors))
 				gog_error_bar_get_minmax (series->errors, &minima, &maxima);
 			else
-				go_data_vector_get_minmax (GO_DATA_VECTOR (
-					series->base.values[1].data), &minima, &maxima);
+				go_data_get_bounds (series->base.values[1].data, &minima, &maxima);
 			if (series->base.plot->desc.series.num_dim == 3) {
 				double tmp_min, tmp_max;
-				go_data_vector_get_minmax (GO_DATA_VECTOR (
-					series->base.values[2].data), &tmp_min, &tmp_max);
+				go_data_get_bounds (series->base.values[2].data, &tmp_min, &tmp_max);
 				if (minima > tmp_min )
 					minima = tmp_min;
 				if (maxima < tmp_max)
@@ -238,13 +236,11 @@ gog_plot1_5d_update (GogObject *obj)
 			if (!gog_series_is_valid (GOG_SERIES (series))) {
 				continue;
 			}
-			vals[i] = go_data_vector_get_values (
-				GO_DATA_VECTOR (series->base.values[1].data));
+			vals[i] = go_data_get_values (series->base.values[1].data);
 			g_object_get (G_OBJECT (series), "errors", errors + i, NULL);
 			if (errors[i])
 				g_object_unref (errors[i]);
-			lengths[i] = go_data_vector_get_len (
-				GO_DATA_VECTOR (series->base.values[1].data));
+			lengths[i] = go_data_get_vector_size (series->base.values[1].data);
 
 			i++;
 		}
@@ -487,18 +483,16 @@ gog_series1_5d_update (GogObject *obj)
 	unsigned old_num = series->base.num_elements;
 
 	if (series->base.values[1].data != NULL) {
-		vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
-		len = go_data_vector_get_len 
-			(GO_DATA_VECTOR (series->base.values[1].data));
+		vals = go_data_get_values (series->base.values[1].data);
+		len = go_data_get_vector_size (series->base.values[1].data);
 	}
 	series->base.num_elements = len;
 
 	if (series->base.plot->desc.series.num_dim == 3) {
 		int tmp = 0;
 		if (series->base.values[2].data != NULL) {
-			vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[2].data));
-			tmp = go_data_vector_get_len 
-				(GO_DATA_VECTOR (series->base.values[2].data));
+			vals = go_data_get_values (series->base.values[2].data);
+			tmp = go_data_get_vector_size (series->base.values[2].data);
 		}
 		if (tmp < len)
 			len = tmp;
diff --git a/plugins/plot_barcol/gog-barcol.c b/plugins/plot_barcol/gog-barcol.c
index 87f20f4..a18a465 100644
--- a/plugins/plot_barcol/gog-barcol.c
+++ b/plugins/plot_barcol/gog-barcol.c
@@ -407,22 +407,20 @@ gog_barcol_view_render (GogView *view, GogViewAllocation const *bbox)
 	lines = g_alloca (num_series * sizeof (GogSeriesLines *));
 	paths = g_alloca (num_series * sizeof (GOPath *));
 	overrides = g_alloca (num_series * sizeof (GSList *));
-	
+
 	i = 0;
 	for (ptr = gog_1_5d_model->base.series ; ptr != NULL ; ptr = ptr->next) {
 		series = ptr->data;
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
-		vals[i] = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		lengths[i] = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
+		vals[i] = go_data_get_values (series->base.values[1].data);
+		lengths[i] = go_data_get_vector_size (series->base.values[1].data);
 		styles[i] = GOG_STYLED_OBJECT (series)->style;
 		errors[i] = series->errors;
 		overrides[i] = gog_series_get_overrides (GOG_SERIES (series));
-		if (gog_error_bar_is_visible (series->errors)) 
+		if (gog_error_bar_is_visible (series->errors))
 			error_data[i] = g_malloc (sizeof (ErrorBarData) * lengths[i]);
-		else 
+		else
 			error_data[i] = NULL;
 		if (series->has_series_lines && lengths[i] > 0) {
 			if (!role)
diff --git a/plugins/plot_barcol/gog-dropbar.c b/plugins/plot_barcol/gog-dropbar.c
index 764877b..f2247ad 100644
--- a/plugins/plot_barcol/gog-dropbar.c
+++ b/plugins/plot_barcol/gog-dropbar.c
@@ -222,14 +222,10 @@ gog_dropbar_view_render (GogView *view, GogViewAllocation const *bbox)
 		neg_style->fill.pattern.back ^= 0xffffff00;
 		neg_style->fill.pattern.fore ^= 0xffffff00;
 		x = offset;
-		start_vals = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		n = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		end_vals = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[2].data));
-		tmp = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[2].data));
+		start_vals = go_data_get_values (series->base.values[1].data);
+		n = go_data_get_vector_size (series->base.values[1].data);
+		end_vals = go_data_get_values (series->base.values[2].data);
+		tmp = go_data_get_vector_size (series->base.values[2].data);
 		if (n > tmp)
 			n = tmp;
 
diff --git a/plugins/plot_barcol/gog-line.c b/plugins/plot_barcol/gog-line.c
index 27a7aac..1763731 100644
--- a/plugins/plot_barcol/gog-line.c
+++ b/plugins/plot_barcol/gog-line.c
@@ -186,7 +186,7 @@ gog_line_series_get_xy_data (GogSeries const *series,
 {
 	GogLineSeries *line_ser = GOG_LINE_SERIES (series);
 	*x = line_ser->x;
-	*y = go_data_vector_get_values (GO_DATA_VECTOR (series->values[1].data));
+	*y = go_data_get_values (series->values[1].data);
 	return series->num_elements;
 }
 
@@ -487,10 +487,8 @@ gog_line_view_render (GogView *view, GogViewAllocation const *bbox)
 			continue;
 		}
 
-		vals[i] = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		lengths[i] = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
+		vals[i] = go_data_get_values (series->base.values[1].data);
+		lengths[i] = go_data_get_vector_size (series->base.values[1].data);
 		styles[i] = GOG_STYLED_OBJECT (series)->style;
 
 		paths[i] = go_path_new ();
diff --git a/plugins/plot_barcol/gog-minmax.c b/plugins/plot_barcol/gog-minmax.c
index 835f3ac..891193e 100644
--- a/plugins/plot_barcol/gog-minmax.c
+++ b/plugins/plot_barcol/gog-minmax.c
@@ -350,14 +350,10 @@ gog_minmax_view_render (GogView *view, GogViewAllocation const *bbox)
 			continue;
 		style = go_styled_object_get_style (GO_STYLED_OBJECT (series));
 		x = offset;
-		min_vals = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		n = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
-		max_vals = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[2].data));
-		tmp = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[2].data));
+		min_vals = go_data_get_values (series->base.values[1].data);
+		n = go_data_get_vector_size (series->base.values[1].data);
+		max_vals = go_data_get_values (series->base.values[2].data);
+		tmp = go_data_get_vector_size (series->base.values[2].data);
 		if (n > tmp)
 			n = tmp;
 		mpath = go_path_new ();
diff --git a/plugins/plot_distrib/gog-boxplot.c b/plugins/plot_distrib/gog-boxplot.c
index 5a42768..1ffe33e 100644
--- a/plugins/plot_distrib/gog-boxplot.c
+++ b/plugins/plot_distrib/gog-boxplot.c
@@ -263,7 +263,7 @@ gog_box_plot_update (GogObject *obj)
 	for (ptr = model->base.series ; ptr != NULL ; ptr = ptr->next) {
 		series = GOG_BOX_PLOT_SERIES (ptr->data);
 		if (!gog_series_is_valid (GOG_SERIES (series)) ||
-			!go_data_vector_get_len (GO_DATA_VECTOR (series->base.values[0].data)))
+			!go_data_get_vector_size (series->base.values[0].data))
 			continue;
 		num_series++;
 		if (series->vals[0] < min)
@@ -300,7 +300,7 @@ gog_box_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 
 	if ((axis == GOG_AXIS_X && model->vertical) ||
 			(axis == GOG_AXIS_Y && !model->vertical)) {
-		GODataScalar *s;
+		GOData *s;
 		GogSeries *series;
 		GSList *ptr;
 		int n = 0;
@@ -309,11 +309,11 @@ gog_box_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 			for (ptr = model->base.series ; ptr != NULL ; ptr = ptr->next) {
 				series = GOG_SERIES (ptr->data);
 				if (!gog_series_is_valid (GOG_SERIES (series)) ||
-					!go_data_vector_get_len (GO_DATA_VECTOR (series->values[0].data)))
+					!go_data_get_vector_size (series->values[0].data))
 					continue;
 				s = gog_series_get_name (series);
 				if (s) {
-					model->names[n] = go_data_scalar_get_str (s);
+					model->names[n] = go_data_get_scalar_string (s);
 					has_names = TRUE;
 				}
 				n++;
@@ -322,8 +322,8 @@ gog_box_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 		bounds->val.maxima = model->num_series + .5;
 		bounds->is_discrete = TRUE;
 		bounds->center_on_ticks = FALSE;
-		return has_names? go_data_vector_str_new (model->names, n, NULL): NULL;
-		
+		return has_names? GO_DATA (go_data_vector_str_new (model->names, n, g_free)): NULL;
+
 	} else {
 		bounds->val.minima = model->min;
 		bounds->val.maxima = model->max;
@@ -459,13 +459,13 @@ gog_box_plot_view_render (GogView *view, GogViewAllocation const *bbox)
 	}
 	hrect /= 2.;
 	hbar = hrect / 2.;
-		
+
 	path = go_path_new ();
 	go_path_set_options (path, GO_PATH_OPTIONS_SHARP);
 	for (ptr = model->base.series ; ptr != NULL ; ptr = ptr->next) {
 		series = ptr->data;
 		if (!gog_series_is_valid (GOG_SERIES (series)) ||
-			!go_data_vector_get_len (GO_DATA_VECTOR (series->base.values[0].data)))
+			!go_data_get_vector_size (series->base.values[0].data))
 			continue;
 		style = go_style_dup (GOG_STYLED_OBJECT (series)->style);
 		y = gog_axis_map_to_view (ser_map, num_ser);
@@ -473,7 +473,7 @@ gog_box_plot_view_render (GogView *view, GogViewAllocation const *bbox)
 		if (model->outliers) {
 			double l1, l2, m1, m2, d, r = 2. * hrect * model->radius_ratio;
 			int i = 0;
-		    	style->outline = style->line;
+			style->outline = style->line;
 			d = series->vals[3] - series->vals[1];
 			l1 = series->vals[1] - d * 1.5;
 			l2 = series->vals[1] - d * 3.;
@@ -599,9 +599,8 @@ gog_box_plot_series_update (GogObject *obj)
 	series->svals = NULL;
 
 	if (series->base.values[0].data != NULL) {
-		vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data));
-		len = go_data_vector_get_len 
-			(GO_DATA_VECTOR (series->base.values[0].data));
+		vals = go_data_get_values (series->base.values[0].data);
+		len = go_data_get_vector_size (series->base.values[0].data);
 	}
 	series->base.num_elements = len;
 	if (len > 0) {
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index a458c94..be7d143 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -87,7 +87,7 @@ gog_histogram_plot_update (GogObject *obj)
 	g_free (series->x);
 	series->x = g_new (double, series->base.num_elements);
 	if (series->base.values[0].data != NULL) {
-		x_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data));
+		x_vals = go_data_get_values (series->base.values[0].data);
 		x_min = x_vals[0];
 		x_max = x_vals[series->base.num_elements];
 		if (model->x.fmt == NULL)
@@ -111,7 +111,7 @@ gog_histogram_plot_update (GogObject *obj)
 	if (series->base.values[1].data != NULL) {
 		if (x_vals) {
 			series->y = g_new (double, series->base.num_elements);
-			y_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
+			y_vals = go_data_get_values (series->base.values[1].data);
 			for (i = 0; i < series->base.num_elements; i++)
 				if (go_finite (y_vals[i])) {
 					series->y[i] = val = y_vals[i] / (x_vals[i+1] - x_vals[i]);
@@ -122,8 +122,7 @@ gog_histogram_plot_update (GogObject *obj)
 				} else
 					series->y[i] = 0.;
 		} else
-			go_data_vector_get_minmax (
-				GO_DATA_VECTOR (series->base.values[1].data), &y_min, &y_max);
+			go_data_get_bounds (series->base.values[1].data, &y_min, &y_max);
 		if (model->y.fmt == NULL)
 			model->y.fmt = go_data_preferred_fmt (series->base.values[1].data);
 	}
@@ -250,10 +249,8 @@ gog_histogram_plot_view_render (GogView *view, GogViewAllocation const *bbox)
 	y_map = gog_chart_map_get_axis_map (chart_map, 1);
 
 	if (series->base.values[0].data)
-		x_vals = go_data_vector_get_values (
-			GO_DATA_VECTOR (series->base.values[0].data));
-	y_vals = (x_vals)? series->y: go_data_vector_get_values (
-		GO_DATA_VECTOR (series->base.values[1].data));
+		x_vals = go_data_get_values (series->base.values[0].data);
+	y_vals = (x_vals)? series->y: go_data_get_values (series->base.values[1].data);
 
 	path = go_path_new ();
 	go_path_set_options (path, GO_PATH_OPTIONS_SHARP);
@@ -409,14 +406,12 @@ gog_histogram_plot_series_update (GogObject *obj)
 	GSList *ptr;
 
 	if (series->base.values[1].data != NULL) {
-		y_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
-		y_len = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
+		y_vals = go_data_get_values (series->base.values[1].data);
+		y_len = go_data_get_vector_size (series->base.values[1].data);
 	}
 	if (series->base.values[0].data != NULL) {
-		x_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data));
-		max = go_data_vector_get_len 
-			(GO_DATA_VECTOR (series->base.values[0].data));
+		x_vals = go_data_get_values (series->base.values[0].data);
+		max = go_data_get_vector_size (series->base.values[0].data);
 		if (max > 0 && go_finite (x_vals[0])) {
 			cur = x_vals[0];
 			for (i = 1; i< max; i++) {
@@ -463,9 +458,10 @@ gog_histogram_plot_series_get_xy_data (GogSeries const *series,
 					double const **x, double const **y)
 {
 	GogHistogramPlotSeries *hist_ser = GOG_HISTOGRAM_PLOT_SERIES (series);
+
 	*x = hist_ser->x;
-	*y = (hist_ser->y)? hist_ser->y:
-		go_data_vector_get_values (GO_DATA_VECTOR (series->values[1].data));
+	*y = (hist_ser->y)? hist_ser->y: go_data_get_values (series->values[1].data);
+
 	return series->num_elements;
 }
 
diff --git a/plugins/plot_distrib/gog-probability-plot.c b/plugins/plot_distrib/gog-probability-plot.c
index d886530..a7c96f7 100644
--- a/plugins/plot_distrib/gog-probability-plot.c
+++ b/plugins/plot_distrib/gog-probability-plot.c
@@ -314,7 +314,7 @@ gog_probability_plot_dataset_dim_changed (GogDataset *set, int dim_i)
 		GValue value = {0};
 		g_value_init (&value, G_TYPE_DOUBLE);
 		if (plot->shape_params[dim_i].elem->data)
-			g_value_set_double (&value, go_data_scalar_get_value (GO_DATA_SCALAR (plot->shape_params[dim_i].elem->data)));
+			g_value_set_double (&value, go_data_get_scalar_value (plot->shape_params[dim_i].elem->data));
 		else
 			g_param_value_set_default (spec, &value);
 		g_param_value_validate (spec, &value);
@@ -422,9 +422,8 @@ gog_probability_plot_series_update (GogObject *obj)
 	g_free (series->x);
 	series->x = NULL;
 	if (series->base.values[0].data != NULL) {
-		x_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data));
-		series->base.num_elements = go_data_vector_get_len 
-			(GO_DATA_VECTOR (series->base.values[0].data));
+		x_vals = go_data_get_values (series->base.values[0].data);
+		series->base.num_elements = go_data_get_vector_size (series->base.values[0].data);
 		if (x_vals)
 			series->x = go_range_sort (x_vals, series->base.num_elements);
 	}
@@ -439,7 +438,7 @@ gog_probability_plot_series_update (GogObject *obj)
 				series->y[i] = go_distribution_get_ppf (dist, (i + .6825) / d);
 			series->y[i] = go_distribution_get_ppf (dist, mn);
 		}
-			
+
 	} else
 		series->y = NULL;
 
diff --git a/plugins/plot_pie/gog-pie.c b/plugins/plot_pie/gog-pie.c
index 0d1f355..9c78932 100644
--- a/plugins/plot_pie/gog-pie.c
+++ b/plugins/plot_pie/gog-pie.c
@@ -419,7 +419,7 @@ find_element (GogView *view, double cx, double cy, double x, double y,
 	if (theta < 0)
 		theta += 1.;
 
-	vals = go_data_vector_get_values (GO_DATA_VECTOR ((*series)->base.values[1].data));
+	vals = go_data_get_values ((*series)->base.values[1].data);
 	scale = 1 / (*series)->total;
 	for (*index = 0 ; *index < (*series)->base.num_elements; (*index)++) {
 		len = fabs (vals[*index]) * scale;
@@ -718,7 +718,7 @@ gog_pie_view_render (GogView *view, GogViewAllocation const *bbox)
 		theta = (model->initial_angle + series->initial_angle) * M_PI / 180. - M_PI / 2.;
 
 		scale = 2 * M_PI / 100 * model->span / series->total;
-		vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
+		vals = go_data_get_values (series->base.values[1].data);
 
 		style = GOG_STYLED_OBJECT (series)->style;
 		if (model->base.vary_style_by_element)
@@ -865,9 +865,8 @@ gog_pie_series_update (GogObject *obj)
 	unsigned old_num = series->base.num_elements;
 
 	if (series->base.values[1].data != NULL) {
-		vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
-		len = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
+		vals = go_data_get_values (series->base.values[1].data);
+		len = go_data_get_vector_size (series->base.values[1].data);
 	}
 	series->base.num_elements = len;
 
diff --git a/plugins/plot_radar/gog-radar.c b/plugins/plot_radar/gog-radar.c
index 8993b5e..e12036f 100644
--- a/plugins/plot_radar/gog-radar.c
+++ b/plugins/plot_radar/gog-radar.c
@@ -156,8 +156,7 @@ gog_rt_plot_update (GogObject *obj)
 
 		if (num_elements < series->base.num_elements)
 			num_elements = series->base.num_elements;
-		go_data_vector_get_minmax (GO_DATA_VECTOR (
-			series->base.values[1].data), &tmp_min, &tmp_max);
+		go_data_get_bounds (series->base.values[1].data, &tmp_min, &tmp_max);
 		if (val_min > tmp_min) val_min = tmp_min;
 		if (val_max < tmp_max) val_max = tmp_max;
 	}
@@ -534,8 +533,7 @@ gog_color_polar_plot_update (GogObject *obj)
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
 
-		go_data_vector_get_minmax (GO_DATA_VECTOR (
-			series->values[2].data), &tmp_min, &tmp_max);
+		go_data_get_bounds (series->values[2].data, &tmp_min, &tmp_max);
 		if (z_min > tmp_min) z_min = tmp_min;
 		if (z_max < tmp_max) z_max = tmp_max;
 	}
@@ -724,10 +722,10 @@ gog_rt_view_render (GogView *view, GogViewAllocation const *bbox)
 
 		gog_renderer_push_style (view->renderer, style);
 
-		r_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
-		c_vals = is_polar ?  go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data)) : NULL;
+		r_vals = go_data_get_values (series->base.values[1].data);
+		c_vals = is_polar ?  go_data_get_values (series->base.values[0].data) : NULL;
 		if (is_map) {
-			z_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[2].data));
+			z_vals = go_data_get_values (series->base.values[2].data);
 			color_style = go_style_dup (style);
 		}
 
@@ -923,9 +921,8 @@ gog_rt_series_update (GogObject *obj)
 	unsigned len = 0;
 
 	if (series->base.values[1].data != NULL) {
-		vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
-		len = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->base.values[1].data));
+		vals = go_data_get_values (series->base.values[1].data);
+		len = go_data_get_vector_size (series->base.values[1].data);
 	}
 	series->base.num_elements = len;
 
diff --git a/plugins/plot_surface/gog-contour.c b/plugins/plot_surface/gog-contour.c
index db246be..e94e416 100644
--- a/plugins/plot_surface/gog-contour.c
+++ b/plugins/plot_surface/gog-contour.c
@@ -55,7 +55,7 @@ gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
 	unsigned nticks;
 	double *x, val;
 	GogSeries *series = GOG_SERIES (plot->base.series->data);
-	GODataMatrix *mat = GO_DATA_MATRIX (series->values[2].data);
+	GOData *mat = series->values[2].data;
 	unsigned n = plot->rows * plot->columns;
 	double *data, minimum, maximum, slope, offset = 0.;
 	unsigned max;
@@ -93,7 +93,7 @@ gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
 	for (i = 0; i < plot->rows; i++)
 		for (j = 0; j < plot->columns; j++) {
 			val = gog_axis_map_to_view (map,
-					go_data_matrix_get_value (mat, i, j));
+					go_data_get_matrix_value (mat, j, i));
 			if (fabs (val) == DBL_MAX)
 				val = go_nan;
 			else {
@@ -250,7 +250,7 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
 {
 	GogXYZPlot const *plot = GOG_XYZ_PLOT (view->model);
 	GogSeries const *series;
-	GODataVector *x_vec = NULL, *y_vec = NULL;
+	GOData *x_vec = NULL, *y_vec = NULL;
 	GogAxisMap *x_map, *y_map;
 	double zval0, zval1, zval2 = 0., zval3, t;
 	double x[4], y[4], zval[4];
@@ -311,8 +311,8 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
 		x1 = gog_axis_map_to_view (x_map, 1.);
 	} else {
 		x_vec = gog_xyz_plot_get_x_vals (GOG_XYZ_PLOT (plot));
-		x0 = gog_axis_map_to_view (x_map, go_data_vector_get_value (x_vec, 0));
-		x1 = gog_axis_map_to_view (x_map, go_data_vector_get_value (x_vec, 1));
+		x0 = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, 0));
+		x1 = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, 1));
 	}
 	ydiscrete = gog_axis_is_discrete (plot->base.axis[1]) ||
 			series->values[(plot->transposed)? 0: 1].data == NULL;
@@ -321,8 +321,8 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
 		y1 = gog_axis_map_to_view (y_map, 1.);
 	} else {
 		y_vec = gog_xyz_plot_get_y_vals (GOG_XYZ_PLOT (plot));
-		y0 = gog_axis_map_to_view (y_map, go_data_vector_get_value (y_vec, 0));
-		y1 = gog_axis_map_to_view (y_map, go_data_vector_get_value (y_vec, 1));
+		y0 = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, 0));
+		y1 = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, 1));
 	}
 	cw = (x1 > x0) == (y1 > y0);
 
@@ -350,16 +350,16 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
 	style->fill.pattern.pattern = GO_PATTERN_SOLID;
 
 	lines = go_path_new ();
-	
+
 	for (j = 1; j < jmax; j++) {
 		if (xdiscrete) {
 			x0 = gog_axis_map_to_view (x_map, j);
 			x1 = gog_axis_map_to_view (x_map, j + 1);
 		} else {
-			x0 = gog_axis_map_to_view (x_map, go_data_vector_get_value (x_vec, j - 1));
-			x1 = gog_axis_map_to_view (x_map, go_data_vector_get_value (x_vec, j));
+			x0 = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j - 1));
+			x1 = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j));
 		}
-		
+
 		for (i = 1; i < imax; i++) {
 			if (ydiscrete) {
 				y0 = gog_axis_map_to_view (y_map, i);
diff --git a/plugins/plot_surface/gog-surface.c b/plugins/plot_surface/gog-surface.c
index 67dcf8b..b9fda6e 100644
--- a/plugins/plot_surface/gog-surface.c
+++ b/plugins/plot_surface/gog-surface.c
@@ -42,7 +42,7 @@ gog_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
 	unsigned i, j;
 	double val;
 	GogSeries *series = GOG_SERIES (plot->base.series->data);
-	GODataMatrix *mat = GO_DATA_MATRIX (series->values[2].data);
+	GOData *mat = series->values[2].data;
 	unsigned n = plot->rows * plot->columns;
 	double *data;
 
@@ -50,7 +50,7 @@ gog_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
 
 	for (i = 0; i < plot->rows; i++)
 		for (j = 0; j < plot->columns; j++) {
-			val = go_data_matrix_get_value (mat, i, j);
+			val = go_data_get_matrix_value (mat, j, i);
 			if (plot->transposed)
 				data[j * plot->rows + i] = val;
 			else
@@ -131,7 +131,7 @@ gog_surface_view_render (GogView *view, GogViewAllocation const *bbox)
 	GogRenderer *rend = view->renderer;
 	GOStyle *style;
 	double *data;
-	GODataVector *x_vec = NULL, *y_vec = NULL;
+	GOData *x_vec = NULL, *y_vec = NULL;
 	gboolean xdiscrete, ydiscrete;
 	gboolean cw;
 	GSList *tiles = NULL, *cur;
@@ -186,15 +186,15 @@ gog_surface_view_render (GogView *view, GogViewAllocation const *bbox)
 				x0 = i;
 				x1 = i + 1;
 			} else {
-				x0 = go_data_vector_get_value (x_vec, i - 1);
-				x1 = go_data_vector_get_value (x_vec, i);
+				x0 = go_data_get_vector_value (x_vec, i - 1);
+				x1 = go_data_get_vector_value (x_vec, i);
 			}
 			if (ydiscrete) {
 				y0 = j;
 				y1 = j + 1;
 			} else {
-				y0 = go_data_vector_get_value (y_vec, j - 1);
-				y1 = go_data_vector_get_value (y_vec, j);
+				y0 = go_data_get_vector_value (y_vec, j - 1);
+				y1 = go_data_get_vector_value (y_vec, j);
 			}
 			nbvalid = 0;
 			z = data[(j - 1) * imax + i - 1];
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index d45208e..8f72b03 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -201,36 +201,33 @@ gog_xyz_surface_plot_update (GogObject *obj)
 	if (!gog_series_is_valid (GOG_SERIES (series)))
 		return;
 	
-	go_data_vector_get_minmax (GO_DATA_VECTOR (
-		series->base.values[0].data), &tmp_min, &tmp_max);
+	go_data_get_bounds (series->base.values[0].data, &tmp_min, &tmp_max);
 	if (!go_finite (tmp_min) || !go_finite (tmp_max) ||
 	    tmp_min > tmp_max) {
 		tmp_min = 0;
-		tmp_max = go_data_vector_get_len (GO_DATA_VECTOR (series->base.values[0].data));
+		tmp_max = go_data_get_vector_size (series->base.values[0].data);
 	} else if (model->x.fmt == NULL)
 		model->x.fmt = go_data_preferred_fmt (series->base.values[0].data);
 	model->x.minima = tmp_min;
 	model->x.maxima = tmp_max;
 	gog_axis_bound_changed (model->base.axis[GOG_AXIS_X], GOG_OBJECT (model));
 
-	go_data_vector_get_minmax (GO_DATA_VECTOR (series->base.values[1].data),
-	                           &tmp_min, &tmp_max);
+	go_data_get_bounds (series->base.values[1].data, &tmp_min, &tmp_max);
 	if (!go_finite (tmp_min) || !go_finite (tmp_max) ||
 	    tmp_min > tmp_max) {
 		tmp_min = 0;
-		tmp_max = go_data_vector_get_len (GO_DATA_VECTOR (series->base.values[1].data));
+		tmp_max = go_data_get_vector_size (series->base.values[1].data);
 	} else if (model->y.fmt == NULL)
 		model->y.fmt = go_data_preferred_fmt (series->base.values[1].data);
 	model->y.minima = tmp_min;
 	model->y.maxima = tmp_max;
 	gog_axis_bound_changed (model->base.axis[GOG_AXIS_Y], GOG_OBJECT (model));
 
-	go_data_vector_get_minmax (GO_DATA_VECTOR (series->base.values[2].data),
-	                           &tmp_min, &tmp_max);
+	go_data_get_bounds (series->base.values[2].data, &tmp_min, &tmp_max);
 	if (!go_finite (tmp_min) || !go_finite (tmp_max) ||
 	    tmp_min > tmp_max) {
 		tmp_min = 0;
-		tmp_max = go_data_vector_get_len (GO_DATA_VECTOR (series->base.values[2].data));
+		tmp_max = go_data_get_vector_size (series->base.values[2].data);
 	} else if (model->z.fmt == NULL)
 		model->z.fmt = go_data_preferred_fmt (series->base.values[2].data);
 	model->z.minima = tmp_min;
diff --git a/plugins/plot_surface/gog-xyz.c b/plugins/plot_surface/gog-xyz.c
index 904704b..818bd60 100644
--- a/plugins/plot_surface/gog-xyz.c
+++ b/plugins/plot_surface/gog-xyz.c
@@ -103,7 +103,7 @@ gog_xyz_plot_populate_editor (GogObject *item,
 }
 #endif
 
-GODataVector *
+GOData *
 gog_xyz_plot_get_x_vals (GogXYZPlot *plot)
 {
 	double inc;
@@ -116,18 +116,16 @@ gog_xyz_plot_get_x_vals (GogXYZPlot *plot)
 			vals = g_new (double, imax);
 			for (i = 0; i < imax; ++i)
 				vals[i] = plot->x.minima + i * inc;
-			plot->x_vals = GO_DATA_VECTOR (go_data_vector_val_new (vals,
-				imax, NULL));
+			plot->x_vals = GO_DATA (go_data_vector_val_new (vals, imax, NULL));
 		}
 		return plot->x_vals;
 	} else {
 		GogSeries *series = GOG_SERIES (plot->base.series->data);
-		return GO_DATA_VECTOR (series->values[(plot->transposed)?
-						      1: 0].data);
+		return series->values[(plot->transposed)?  1: 0].data;
 	}
 }
 
-GODataVector *
+GOData *
 gog_xyz_plot_get_y_vals (GogXYZPlot *plot)
 {
 	double inc;
@@ -140,14 +138,12 @@ gog_xyz_plot_get_y_vals (GogXYZPlot *plot)
 			vals = g_new (double, imax);
 			for (i = 0; i < imax; ++i)
 				vals[i] = plot->y.minima + i * inc;
-			plot->y_vals = GO_DATA_VECTOR (go_data_vector_val_new (vals,
-				imax, NULL));
+			plot->y_vals = GO_DATA (go_data_vector_val_new (vals, imax, NULL));
 		}
 		return plot->y_vals;
 	} else {
 		GogSeries *series = GOG_SERIES (plot->base.series->data);
-		return GO_DATA_VECTOR (series->values[(plot->transposed)?
-						      0: 1].data);
+		return series->values[(plot->transposed)?  0: 1].data;
 	}
 }
 
@@ -173,8 +169,8 @@ gog_xyz_plot_update (GogObject *obj)
 {
 	GogXYZPlot * model = GOG_XYZ_PLOT(obj);
 	GogXYZSeries * series;
-	GODataVector *vec;
-	GODataMatrix *mat;
+	GOData *vec;
+	GOData *mat;
 	double tmp_min, tmp_max;
 
 	if (model->base.series == NULL)
@@ -190,11 +186,11 @@ gog_xyz_plot_update (GogObject *obj)
 	if (!gog_series_is_valid (GOG_SERIES (series)))
 		return;
 
-	if ((vec = GO_DATA_VECTOR (series->base.values[0].data)) != NULL) {
+	if ((vec = series->base.values[0].data) != NULL) {
 		if (model->x.fmt == NULL)
 			model->x.fmt = go_data_preferred_fmt (series->base.values[0].data);
-		if (go_data_vector_vary_uniformly (vec))
-			go_data_vector_get_minmax (vec, &tmp_min, &tmp_max);
+		if (go_data_is_varying_uniformly (vec))
+			go_data_get_bounds (vec, &tmp_min, &tmp_max);
 		else
 			tmp_min = tmp_max = go_nan;
 	} else {
@@ -212,11 +208,11 @@ gog_xyz_plot_update (GogObject *obj)
 				GOG_OBJECT (model));
 	}
 
-	if ((vec = GO_DATA_VECTOR (series->base.values[1].data)) != NULL) {
+	if ((vec = series->base.values[1].data) != NULL) {
 		if (model->y.fmt == NULL)
 			model->y.fmt = go_data_preferred_fmt (series->base.values[1].data);
-		if (go_data_vector_vary_uniformly (vec))
-			go_data_vector_get_minmax (vec, &tmp_min, &tmp_max);
+		if (go_data_is_varying_uniformly (vec))
+			go_data_get_bounds (vec, &tmp_min, &tmp_max);
 		else
 			tmp_min = tmp_max = go_nan;
 	} else {
@@ -236,8 +232,8 @@ gog_xyz_plot_update (GogObject *obj)
 
 	g_free (model->plotted_data);
 	model->plotted_data = NULL;
-	mat = GO_DATA_MATRIX (series->base.values[2].data);
-	go_data_matrix_get_minmax (mat, &tmp_min, &tmp_max);
+	mat = series->base.values[2].data;
+	go_data_get_bounds (mat, &tmp_min, &tmp_max);
 	if ((tmp_min != model->z.minima)
 			|| (tmp_max != model->z.maxima)) {
 		model->z.minima = tmp_min;
@@ -259,7 +255,7 @@ gog_xyz_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 {
 	GogXYZSeries *series;
 	GogXYZPlot *xyz = GOG_XYZ_PLOT (plot);
-	GODataVector *vec = NULL;
+	GOData *vec = NULL;
 	double min, max;
 	GOFormat *fmt;
 	if (!plot->series)
@@ -267,12 +263,12 @@ gog_xyz_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 	series = GOG_XYZ_SERIES (plot->series->data);
 	if ((axis == GOG_AXIS_Y && xyz->transposed) ||
 		(axis == GOG_AXIS_X && !xyz->transposed)) {
-		vec = GO_DATA_VECTOR (series->base.values[0].data);
+		vec = series->base.values[0].data;
 		fmt = xyz->x.fmt;
 		min = xyz->x.minima;
 		max = xyz->x.maxima;
 	} else if (axis == GOG_AXIS_X || axis == GOG_AXIS_Y) {
-		vec = GO_DATA_VECTOR (series->base.values[1].data);
+		vec = series->base.values[1].data;
 		fmt = xyz->y.fmt;
 		min = xyz->y.minima;
 		max = xyz->y.maxima;
@@ -436,8 +432,8 @@ gog_xyz_series_update (GogObject *obj)
 {
 	GogXYZSeries *series = GOG_XYZ_SERIES (obj);
 	GODataMatrixSize size, old_size;
-	GODataMatrix *mat;
-	GODataVector *vec;
+	GOData *mat;
+	GOData *vec;
 	int length;
 	size.rows = 0;
 	size.columns = 0;
@@ -450,21 +446,21 @@ gog_xyz_series_update (GogObject *obj)
 		if (series->base.values[2].data != NULL) {
 			old_size.rows = series->rows;
 			old_size.columns = series->columns;
-			mat = GO_DATA_MATRIX (series->base.values[2].data);
-			go_data_matrix_get_values (mat);
-			size = go_data_matrix_get_size (mat);
+			mat = series->base.values[2].data;
+			go_data_get_values (mat);
+			go_data_get_matrix_size (mat, &size.columns, &size.rows);
 		}
 		if (series->base.values[0].data != NULL) {
-			vec = GO_DATA_VECTOR (series->base.values[0].data);
-			go_data_vector_get_values (vec);
-			length = go_data_vector_get_len (vec);
+			vec = series->base.values[0].data;
+			go_data_get_values (vec);
+			length = go_data_get_vector_size (vec);
 			if (length < size.columns)
 				size.columns = length;
 		}
 		if (series->base.values[1].data != NULL) {
-			vec = GO_DATA_VECTOR (series->base.values[1].data);
-			go_data_vector_get_values (vec);
-			length = go_data_vector_get_len (vec);
+			vec = series->base.values[1].data;
+			go_data_get_values (vec);
+			length = go_data_get_vector_size (vec);
 			if (length < size.rows)
 				size.rows = length;
 		}
diff --git a/plugins/plot_surface/gog-xyz.h b/plugins/plot_surface/gog-xyz.h
index 0c39f3d..8bd07e6 100644
--- a/plugins/plot_surface/gog-xyz.h
+++ b/plugins/plot_surface/gog-xyz.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 
 typedef struct {
 	GogPlot	base;
-	
+
 	unsigned rows, columns;
 	gboolean transposed;
 	gboolean data_xyz;
@@ -44,7 +44,7 @@ typedef struct {
 		GOFormat *fmt;
 	} x, y, z;
 	double *plotted_data;
-	GODataVector *x_vals, *y_vals;
+	GOData *x_vals, *y_vals;
 } GogXYZPlot;
 
 #define GOG_TYPE_XYZ_PLOT	(gog_xyz_plot_get_type ())
@@ -59,19 +59,19 @@ typedef struct {
 	GogAxisType third_axis;
 
 	double * (*build_matrix) (GogXYZPlot const *plot, gboolean *cardinality_changed);
-	GODataVector * (*get_x_vals) (GogXYZPlot *plot);
-	GODataVector * (*get_y_vals) (GogXYZPlot *plot);
+	GOData * (*get_x_vals) (GogXYZPlot *plot);
+	GOData * (*get_y_vals) (GogXYZPlot *plot);
 } GogXYZPlotClass;
 
 #define GOG_XYZ_PLOT_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_XYZ_PLOT, GogXYZPlotClass))
 
 double *gog_xyz_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed);
-GODataVector *gog_xyz_plot_get_x_vals (GogXYZPlot *plot);
-GODataVector *gog_xyz_plot_get_y_vals (GogXYZPlot *plot);
+GOData *gog_xyz_plot_get_x_vals (GogXYZPlot *plot);
+GOData *gog_xyz_plot_get_y_vals (GogXYZPlot *plot);
 
 typedef struct {
 	GogSeries base;
-	
+
 	unsigned rows, columns;
 } GogXYZSeries;
 typedef GogSeriesClass GogXYZSeriesClass;
diff --git a/plugins/plot_surface/xl-surface.c b/plugins/plot_surface/xl-surface.c
index bb2cf13..bc488b7 100644
--- a/plugins/plot_surface/xl-surface.c
+++ b/plugins/plot_surface/xl-surface.c
@@ -48,11 +48,9 @@ xl_xyz_series_update (GogObject *obj)
 	int x_len = 0, z_len = 0;
 
 	if (series->values[1].data != NULL)
-		z_len = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->values[1].data));
+		z_len = go_data_get_vector_size (series->values[1].data);
 	if (series->values[0].data != NULL)
-		x_len = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->values[0].data));
+		x_len = go_data_get_vector_size (series->values[0].data);
 	else
 		x_len = z_len;
 	series->num_elements = MIN (x_len, z_len);
@@ -108,16 +106,13 @@ xl_xyz_plot_update (GogObject *obj)
 	/* for first series, num_elements is used for zaxis, so we
 	can't use it to evaluate model->columns */
 	if (series->values[1].data != NULL) {
-		model->columns = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->values[1].data));
+		model->columns = go_data_get_vector_size (series->values[1].data);
 		if (series->values[0].data != NULL)
-				model->rows = go_data_vector_get_len (
-				GO_DATA_VECTOR (series->values[0].data));
+			model->rows = go_data_get_vector_size (series->values[0].data);
 		if (model->rows < model->columns)
 			model->columns = model->rows;
 	} else if (series->values[0].data != NULL)
-		model->columns = go_data_vector_get_len (
-			GO_DATA_VECTOR (series->values[0].data));
+		model->columns = go_data_get_vector_size (series->values[0].data);
 	model->rows = 1;
 
 	for (ptr = ptr->next; ptr != NULL; ptr = ptr->next) {
@@ -127,8 +122,7 @@ xl_xyz_plot_update (GogObject *obj)
 		if (series->num_elements > model->columns)
 			model->columns = series->num_elements;
 		model->rows++;
-		go_data_vector_get_minmax (GO_DATA_VECTOR (
-			series->values[1].data), &tmp_min, &tmp_max);
+		go_data_get_bounds (series->values[1].data, &tmp_min, &tmp_max);
 		if (zmin > tmp_min) zmin = tmp_min;
 		if (zmax < tmp_max) zmax = tmp_max;
 	}
@@ -146,7 +140,7 @@ xl_xyz_plot_update (GogObject *obj)
 	gog_axis_bound_changed (model->base.axis[GOG_AXIS_Y], obj);
 }
 
-static GODataVector *
+static GOData *
 get_y_vector (GogPlot *plot)
 {
 	GSList *ptr;
@@ -164,24 +158,24 @@ get_y_vector (GogPlot *plot)
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
 		(*y_labels) [i] = (series->values[-1].data)?
-				g_strdup (go_data_scalar_get_str (GO_DATA_SCALAR (series->values[-1].data))):
+				go_data_get_scalar_string (series->values[-1].data):
 				g_strdup_printf("S%d", i + 1); /* excel like labels */
 	}
 
-	return GO_DATA_VECTOR (go_data_vector_str_new (*y_labels, i, g_free));
+	return GO_DATA (go_data_vector_str_new (*y_labels, i, g_free));
 }
 
 static GOData *
-xl_xyz_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis, 
-				GogPlotBoundInfo * bounds)
+xl_xyz_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
+			     GogPlotBoundInfo * bounds)
 {
 	GogXYZPlot *xyz = GOG_XYZ_PLOT (plot);
-	GODataVector *vec = NULL;
+	GOData *vec = NULL;
 	GOFormat *fmt;
 
 	if (axis == GOG_AXIS_X) {
 		XLXYZSeries *series = XL_XYZ_SERIES (plot->series->data);
-		vec = GO_DATA_VECTOR (series->values[0].data);
+		vec = series->values[0].data;
 		fmt = xyz->x.fmt;
 	} else if (axis == GOG_AXIS_Y) {
 		if (!xyz->rows)
@@ -224,7 +218,7 @@ xl_contour_plot_build_matrix (GogXYZPlot const *plot,
 	unsigned nticks;
 	double x[2], val;
 	GogSeries *series = NULL;
-	GODataVector *vec;
+	GOData *vec;
 	unsigned n = plot->rows * plot->columns;
 	double *data, minimum, maximum;
 	unsigned max;
@@ -247,12 +241,12 @@ xl_contour_plot_build_matrix (GogXYZPlot const *plot,
 		series = ptr->data;
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
-		vec = GO_DATA_VECTOR (series->values[1].data);
-		length = go_data_vector_get_len (vec);
+		vec = series->values[1].data;
+		length = go_data_get_vector_size (vec);
 		for (j = 0; j < plot->columns; j++) {
 			/* The vector might be too short, excel is so ugly ;-) */
 			val = (j < length)? gog_axis_map_to_view (map,
-					go_data_vector_get_value (vec, j)): 0.;
+					go_data_get_vector_value (vec, j)): 0.;
 			/* This is an excel compatible plot, so let's be compatible */
 			if (val == go_nan || !go_finite (val))
 				val = 0.;
@@ -343,7 +337,7 @@ xl_surface_plot_build_matrix (GogXYZPlot const *plot,
 	unsigned i, j, length;
 	double val;
 	GogSeries *series = NULL;
-	GODataVector *vec;
+	GOData *vec;
 	unsigned n = plot->rows * plot->columns;
 	double *data;
 	GSList *ptr;
@@ -353,11 +347,11 @@ xl_surface_plot_build_matrix (GogXYZPlot const *plot,
 		series = ptr->data;
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
-		vec = GO_DATA_VECTOR (series->values[1].data);
-		length = go_data_vector_get_len (vec);
+		vec = series->values[1].data;
+		length = go_data_get_vector_size (vec);
 		for (j = 0; j < plot->columns; j++) {
 			/* The vector might be too short, excel is so ugly ;-) */
-			val = (j < length)? go_data_vector_get_value (vec, j): 0.;
+			val = (j < length)? go_data_get_vector_value (vec, j): 0.;
 			/* This is an excel compatible plot, so let's be compatible */
 			if (val == go_nan || !go_finite (val))
 				val = 0.;
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 3c13850..d24897e 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -100,30 +100,26 @@ gog_2d_plot_update (GogObject *obj)
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
 
-		go_data_vector_get_minmax (GO_DATA_VECTOR (
-			series->base.values[1].data), &tmp_min, &tmp_max);
+		go_data_get_bounds (series->base.values[1].data, &tmp_min, &tmp_max);
 		if (y_min > tmp_min) y_min = tmp_min;
 		if (y_max < tmp_max) y_max = tmp_max;
 		if (model->y.fmt == NULL)
 			model->y.fmt = go_data_preferred_fmt (series->base.values[1].data);
 
 		if (series->base.values[0].data != NULL) {
-			go_data_vector_get_minmax (GO_DATA_VECTOR (
-				series->base.values[0].data), &tmp_min, &tmp_max);
+			go_data_get_bounds (series->base.values[0].data, &tmp_min, &tmp_max);
 
 			if (!go_finite (tmp_min) || !go_finite (tmp_max) ||
 			    tmp_min > tmp_max) {
 				tmp_min = 0;
-				tmp_max = go_data_vector_get_len (
-					GO_DATA_VECTOR (series->base.values[1].data));
+				tmp_max = go_data_get_vector_size (series->base.values[1].data);
 
 				is_discrete = TRUE;
 			} else if (model->x.fmt == NULL)
 				model->x.fmt = go_data_preferred_fmt (series->base.values[0].data);
 		} else {
 			tmp_min = 0;
-			tmp_max = go_data_vector_get_len (
-				GO_DATA_VECTOR (series->base.values[1].data));
+			tmp_max = go_data_get_vector_size (series->base.values[1].data);
 			is_discrete = TRUE;
 		}
 
@@ -623,8 +619,7 @@ gog_xy_color_plot_update (GogObject *obj)
 		if (!gog_series_is_valid (GOG_SERIES (series)))
 			continue;
 
-		go_data_vector_get_minmax (GO_DATA_VECTOR (
-			series->base.values[2].data), &tmp_min, &tmp_max);
+		go_data_get_bounds (series->base.values[2].data, &tmp_min, &tmp_max);
 		if (z_min > tmp_min) z_min = tmp_min;
 		if (z_max < tmp_max) z_max = tmp_max;
 		if (model->z.fmt == NULL)
@@ -1105,7 +1100,7 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
 
 		if (GOG_IS_BUBBLE_PLOT (model)) {
 			double zmin;
-			go_data_vector_get_minmax (GO_DATA_VECTOR (series->base.values[2].data), &zmin, &zmax);
+			go_data_get_bounds (series->base.values[2].data, &zmin, &zmax);
 			show_negatives = GOG_BUBBLE_PLOT (view->model)->show_negatives;
 			if ((! go_finite (zmax)) || (!show_negatives && (zmax <= 0))) continue;
 			rmax = MIN (view->residual.w, view->residual.h) / BUBBLE_MAX_RADIUS_RATIO
@@ -1466,8 +1461,8 @@ static void
 gog_xy_interpolation_clamps_dataset_dim_changed (GogDataset *set, int dim_i)
 {
 	GogXYInterpolationClamps *clamps = GOG_XY_INTERPOLATION_CLAMPS (set);
-	clamps->series->clamped_derivs[dim_i] = (GO_IS_DATA_SCALAR ((clamps->derivs + dim_i)->data))?
-		go_data_scalar_get_value (GO_DATA_SCALAR ((clamps->derivs + dim_i)->data)): 0.;
+	clamps->series->clamped_derivs[dim_i] = (GO_IS_DATA ((clamps->derivs + dim_i)->data))?
+		go_data_get_scalar_value ((clamps->derivs + dim_i)->data): 0.;
 	gog_object_request_update (GOG_OBJECT (clamps->series));
 }
 
diff --git a/plugins/smoothing/gog-exp-smooth.c b/plugins/smoothing/gog-exp-smooth.c
index 8eeea81..8666812 100644
--- a/plugins/smoothing/gog-exp-smooth.c
+++ b/plugins/smoothing/gog-exp-smooth.c
@@ -125,8 +125,7 @@ gog_exp_smooth_update (GogObject *obj)
 	go_range_min (x, n, &xmin);
 	go_range_max (x, n, &xmax);
 	if (es->period->data != NULL)
-		period = go_data_scalar_get_value (
-			GO_DATA_SCALAR (es->period->data));
+		period = go_data_get_scalar_value (es->period->data);
 	if (period <= 0.)
 		period = 10. * (xmax - xmin) / (n - 1);
 
@@ -141,7 +140,7 @@ gog_exp_smooth_update (GogObject *obj)
 		nb = (unsigned) ceil ((x[i] - xmin) / delta - epsilon);
 		t = pow (2., (x[i] - xmin - nb * delta) / period);
 		incr[nb] += t * y[i];
-		w[nb] += t;		
+		w[nb] += t;
 	}
 	r = pow (2., -delta / period);
 	t = u = 0.;



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