static void gog_pie_series_update (GogObject *obj) { double *vals = NULL, total; int len = 0; GogPieSeries *series = GOG_PIE_SERIES (obj); unsigned old_num = series->base.num_elements; GogShowNegsMode mode = GOG_PIE_PLOT (series->base.plot)->show_negatives; if (series->base.values[1].data != NULL) { 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; for (total = 0. ; len-- > 0 ;) { double val = vals[len]; if (go_finite (val)) { if (val < 0) val = (mode == GOG_SHOW_NEGS_SKIP)? 0.: -val; total += val; } } series->total = total; /* queue plot for redraw */ gog_object_request_update (GOG_OBJECT (series->base.plot)); if (old_num != series->base.num_elements) gog_plot_request_cardinality_update (series->base.plot); if (series_parent_klass->update) series_parent_klass->update (obj); }
static void gog_xy_dropbar_series_update (GogObject *obj) { const double *x_vals, *y_vals, *z_vals; GogSeries *series = GOG_SERIES (obj); unsigned old_num = series->num_elements; series->num_elements = gog_series_get_xyz_data (series, &x_vals, &y_vals, &z_vals); /* queue plot for redraw */ gog_object_request_update (GOG_OBJECT (series->plot)); if (old_num != series->num_elements) gog_plot_request_cardinality_update (series->plot); if (series_parent_klass->update) series_parent_klass->update (obj); }
static void gog_trend_line_set_property (GObject *obj, guint param_id, GValue const *value, GParamSpec *pspec) { gboolean b_tmp; switch (param_id) { case TREND_LINE_PROP_HAS_LEGEND : b_tmp = g_value_get_boolean (value); if (GPOINTER_TO_INT (g_object_get_data (obj, "has-legend")) ^ b_tmp) { GogSeries *series = GOG_SERIES (gog_object_get_parent (GOG_OBJECT (obj))); g_object_set_data (obj, "has-legend", GINT_TO_POINTER (b_tmp)); if (series->plot != NULL) gog_plot_request_cardinality_update (series->plot); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); return; /* NOTE : RETURN */ } gog_object_emit_changed (GOG_OBJECT (obj), FALSE); }