Re: Add data to a GogBarColPlot with stacked columns
- From: Jean Bréfort <jean brefort normalesup org>
- To: Antonio Álvarez Feijoo <aalvarez igalia com>
- Cc: gnumeric-list gnome org
- Subject: Re: Add data to a GogBarColPlot with stacked columns
- Date: Fri, 25 Apr 2008 10:35:42 +0200
Le vendredi 25 avril 2008 à 09:34 +0200, Antonio Álvarez Feijoo a
écrit :
Hello,
I have been all week trying to make a GogBarColPlot with stacked columns,
but I have not been able to.
For example, I want 4 columns with two different values in each one.
With the values of X axis I don't have any problem:
gchar ** t_legends;
t_legends = g_new (gchar*, n_max_datetimes);
/* ... */
data = go_data_vector_str_new (t_legends, 4, g_free);
gog_series_set_dim (series, 0, data, &error);
The two attempts for the columns that I have made (memory crashes...) were:
1. gdouble *t_values_1;
t_values_1 = g_new (gdouble, 4);
t_values_1[0] = 20;
t_values_1[1] = 20;
t_values_1[2] = 20;
t_values_1[3] = 0;
data = go_data_vector_val_new (t_values_1, 4, g_free);
gog_series_set_dim (series, 1, data, &error);
gdouble *t_values_2;
t_values_2 = g_new (gdouble, 4);
t_values_2[0] = 50;
t_values_2[1] = 50;
t_values_2[2] = 0;
t_values_2[3] = 30;
data = go_data_vector_val_new (t_values_2, 4, g_free);
gog_series_set_dim (series, 2, data, &error);
2. gdouble *t_values_1;
t_values_1 = g_new (gdouble, 4);
t_values_1[0] = 20;
t_values_1[1] = 20;
t_values_1[2] = 20;
t_values_1[3] = 0;
t_values_1[4] = 50;
t_values_1[5] = 50;
t_values_1[6] = 0;
t_values_1[7] = 30;
data = go_data_vector_val_new (t_values_1, 4, g_free);
gog_series_set_dim (series, 1, data, &error);
for 2. you need g_new (double, 8), but in all cases, it is not the right
way to do what you want.
for 1. you need to create a second series, somethings as (not tested):
GogPlot *col = (GogPlot *) gog_plot_new_by_name ("GogBarColPlot");
g_object_set (col, "type", "stacked", NULL);
GogSeries *series = gog_plot_new_series (col);
gchar ** t_legends;
t_legends = g_new (gchar*, n_max_datetimes);
/* ... */
data = go_data_vector_str_new (t_legends, 4, g_free);
gog_series_set_dim (series, 0, data, &error);
gdouble *t_values_1;
t_values_1 = g_new (gdouble, 4);
t_values_1[0] = 20;
t_values_1[1] = 20;
t_values_1[2] = 20;
t_values_1[3] = 0;
data = go_data_vector_val_new (t_values_1, 4, g_free);
gog_series_set_dim (series, 1, data, &error);
series = gog_plot_new_series (col);
t_values_1 = g_new (gdouble, 4);
t_values_1[0] = 50;
t_values_1[1] = 50;
t_values_1[2] = 0;
t_values_1[3] = 30;
data = go_data_vector_val_new (t_values_1, 4, g_free);
gog_series_set_dim (series, 1, data, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]