[goffice] fixed 383518
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] fixed 383518
- Date: Fri, 6 Nov 2009 17:55:55 +0000 (UTC)
commit 09b864f7ddfb84cde28dcd3165325f5173a60d29
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Nov 6 18:49:24 2009 +0100
fixed 383518
goffice/graph/gog-plot.c | 31 +++++++++++++++++++++++++------
goffice/graph/gog-series.c | 9 +++++++++
2 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index d21b7b6..565dd8c 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -645,14 +645,14 @@ void
gog_plot_update_cardinality (GogPlot *plot, int index_num)
{
GogSeries *series;
- GSList *ptr;
+ GSList *ptr, *children;
gboolean is_valid;
- unsigned size = 0, no_legend = 0, i;
+ unsigned size = 0, no_legend = 0, i, j;
g_return_if_fail (GOG_IS_PLOT (plot));
plot->cardinality_valid = TRUE;
- plot->index_num = i = index_num;
+ plot->index_num = i = j = index_num;
for (ptr = plot->series; ptr != NULL ; ptr = ptr->next) {
series = GOG_SERIES (ptr->data);
@@ -665,11 +665,19 @@ gog_plot_update_cardinality (GogPlot *plot, int index_num)
gog_series_set_index (series, i++, FALSE);
if (!gog_series_has_legend (series))
no_legend++;
+ j++;
+ }
+ /* now add the trend lines if any */
+ children = GOG_OBJECT (series)->children;
+ while (children) {
+ if (GOG_IS_TREND_LINE (children->data))
+ j++;
+ children = children->next;
}
}
plot->full_cardinality =
- plot->vary_style_by_element ? size : (i - plot->index_num);
+ plot->vary_style_by_element ? size : (j - plot->index_num);
plot->visible_cardinality = plot->full_cardinality - no_legend;
}
@@ -709,7 +717,7 @@ void
gog_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
GogEnumFunc func, gpointer data)
{
- GSList *ptr;
+ GSList *ptr, *children;
GogSeries const *series;
GOStyle *style, *tmp_style;
GOData *labels;
@@ -740,12 +748,23 @@ gog_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
if (gog_plot_enum_in_reverse (plot))
ptr = tmp = g_slist_reverse (g_slist_copy (ptr));
- for (; ptr != NULL ; ptr = ptr->next)
+ for (; ptr != NULL ; ptr = ptr->next) {
if (!only_visible || gog_series_has_legend (ptr->data)) {
func (i, go_styled_object_get_style (ptr->data),
gog_object_get_name (ptr->data), data);
i++;
}
+ /* now add the trend lines if any */
+ children = GOG_OBJECT (ptr->data)->children;
+ while (children) {
+ if (GOG_IS_TREND_LINE (children->data)) {
+ func (i, go_styled_object_get_style (children->data),
+ gog_object_get_name (children->data), data);
+ i++;
+ }
+ children = children->next;
+ }
+ }
g_slist_free (tmp);
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index f253461..175e37c 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -606,6 +606,13 @@ gog_series_update (GogObject *obj)
}
static void
+gog_series_child_added (GogObject *parent, GogObject *child)
+{
+ if (GOG_IS_TREND_LINE (child))
+ gog_plot_request_cardinality_update (GOG_SERIES (parent)->plot);
+}
+
+static void
gog_series_init_style (GogStyledObject *gso, GOStyle *style)
{
GogSeries const *series = (GogSeries const *)gso;
@@ -658,6 +665,8 @@ gog_series_class_init (GogSeriesClass *klass)
gog_klass->populate_editor = gog_series_populate_editor;
#endif
gog_klass->update = gog_series_update;
+ gog_klass->child_added = gog_series_child_added;
+ gog_klass->child_removed = gog_series_child_added;
style_klass->init_style = gog_series_init_style;
/* series do not have views, so just forward signals from the plot */
gog_klass->use_parent_as_proxy = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]