[goffice] Fix custom point marker in scatter plots. [#596585]
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] Fix custom point marker in scatter plots. [#596585]
- Date: Tue, 29 Sep 2009 06:17:43 +0000 (UTC)
commit b8e3e40766795c6f3fbdda9bea9b110f1124bfca
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Sep 29 08:17:08 2009 +0200
Fix custom point marker in scatter plots. [#596585]
ChangeLog | 5 +++
NEWS | 1 +
plugins/plot_xy/gog-xy.c | 80 +++++++++++++++++++++++++++++----------------
3 files changed, 57 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d267586..1d56cc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-29 Jean Brefort <jean brefort normalesup org>
+
+ * plugins/plot_xy/gog-xy.c (gog_xy_view_render): fix point custom
+ marker rendering. [#596585]
+
2009-09-27 Jean Brefort <jean brefort normalesup org>
* configure.in: don't allow gtk-doc if without-gtk.
diff --git a/NEWS b/NEWS
index a965d8b..c1cf021 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.7.14:
Jean:
* Fix unicolor gradient brightness.
+ * Fix custom point marker in scatter plots. [#596585]
--------------------------------------------------------------------------
goffice 0.7.13:
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index cc7f49a..8036bbe 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -858,6 +858,7 @@ get_map_color (double z, gboolean hide_outliers)
typedef struct {
double x, y;
GOColor color;
+ int index;
} MarkerData;
static void
@@ -1212,6 +1213,7 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
y_margin_min <= y_canvas && y_canvas <= y_margin_max) {
markers[j][k].x = x_canvas;
markers[j][k].y = y_canvas;
+ markers[j][k].index = i;
if (is_map)
markers[j][k].color = (gog_axis_map_finite (z_map, z))?
get_map_color (gog_axis_map_to_view (z_map, z), hide_outliers):
@@ -1238,42 +1240,62 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
if (!GOG_IS_BUBBLE_PLOT (model))
for (j = 0, ptr = model->base.series ; ptr != NULL ; ptr = ptr->next, j++) {
+ series = ptr->data;
overrides = gog_series_get_overrides (GOG_SERIES (series));
- if (markers[j] != NULL) {
- series = ptr->data;
- overrides = gog_series_get_overrides (GOG_SERIES (series));
- style = GOG_STYLED_OBJECT (series)->style;
- gog_renderer_push_style (view->renderer, style);
- for (k = 0; k < num_markers[j]; k++) {
- gse = NULL;
- if ((overrides != NULL) &&
- (GOG_SERIES_ELEMENT (overrides->data)->index == k)) {
- gse = GOG_SERIES_ELEMENT (overrides->data);
- overrides = overrides->next;
- style = go_styled_object_get_style (GO_STYLED_OBJECT (gse));
- gog_renderer_push_style (view->renderer, style);
- }
- if (is_map) {
- go_marker_set_outline_color
- (style->marker.mark,markers[j][k].color);
- go_marker_set_fill_color
- (style->marker.mark,markers[j][k].color);
+ if (markers[j] != NULL) {
+ style = GOG_STYLED_OBJECT (series)->style;
+ gog_renderer_push_style (view->renderer, style);
+ for (k = 0; k < num_markers[j]; k++) {
+ gse = NULL;
+ if (overrides != NULL) {
+ while (GOG_SERIES_ELEMENT (overrides->data)->index < markers[j][k].index)
+ overrides = overrides->next;
+ if (GOG_SERIES_ELEMENT (overrides->data)->index == markers[j][k].index) {
+ gse = GOG_SERIES_ELEMENT (overrides->data);
+ overrides = overrides->next;
+ style = go_styled_object_get_style (GO_STYLED_OBJECT (gse));
gog_renderer_push_style (view->renderer, style);
}
+ }
+ if (is_map) {
+ go_marker_set_outline_color
+ (style->marker.mark,markers[j][k].color);
+ go_marker_set_fill_color
+ (style->marker.mark,markers[j][k].color);
+ gog_renderer_push_style (view->renderer, style);
+ }
+ gog_renderer_draw_marker (view->renderer,
+ markers[j][k].x,
+ markers[j][k].y);
+ if (is_map)
+ gog_renderer_pop_style (view->renderer);
+ if (gse) {
+ gog_renderer_pop_style (view->renderer);
+ style = GOG_STYLED_OBJECT (series)->style;
+ }
+ }
+ gog_renderer_pop_style (view->renderer);
+ g_free (markers[j]);
+ } else if (overrides != NULL) {
+ gog_series_get_xy_data (GOG_SERIES (series), &x_vals, &y_vals);
+ while (overrides != NULL) {
+ gse = GOG_SERIES_ELEMENT (overrides->data);
+ x = x_vals ? x_vals[gse->index] : gse->index;
+ y = y_vals[gse->index];
+ if (gog_axis_map_finite (y_map, y) && gog_axis_map_finite (x_map, x)) {
+ style = go_styled_object_get_style (GO_STYLED_OBJECT (gse));
+ gog_renderer_push_style (view->renderer, style);
+ x_canvas = gog_axis_map_to_view (x_map, x);
+ y_canvas = gog_axis_map_to_view (y_map, y);
gog_renderer_draw_marker (view->renderer,
- markers[j][k].x,
- markers[j][k].y);
- if (is_map)
- gog_renderer_pop_style (view->renderer);
- if (gse) {
- gog_renderer_pop_style (view->renderer);
- style = GOG_STYLED_OBJECT (series)->style;
- }
+ x_canvas,
+ y_canvas);
+ gog_renderer_pop_style (view->renderer);
}
- gog_renderer_pop_style (view->renderer);
- g_free (markers[j]);
+ overrides = overrides->next;
}
}
+ }
/* Now render children, may be should come before markers? */
for (ptr = view->children ; ptr != NULL ; ptr = ptr->next)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]