[goffice] Fix legends for plots with marker only style. [#647367]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix legends for plots with marker only style. [#647367]
- Date: Sun, 10 Apr 2011 17:00:49 +0000 (UTC)
commit bf0bd94afe5e4c8f750b76336746242a95cf001d
Author: Jean Brefort <jean brefort normalesup org>
Date: Sun Apr 10 19:01:23 2011 +0200
Fix legends for plots with marker only style. [#647367]
ChangeLog | 5 +++++
NEWS | 1 +
goffice/graph/gog-legend.c | 15 ++++++++++++++-
3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4319f31..cc9b8fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-10 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-legend.c (cb_render_elements): fix legends for plots
+ with marker only style. [#647367]
+
2011-04-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (go_format_token2): localized colour
diff --git a/NEWS b/NEWS
index dba430b..91cfc59 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
Jean:
* Fixed closed bezier spline evaluation. [#646700]
* Implement dropbar plots with linear or logarithmic index axis. [#646832]
+ * Fix legends for plots with marker only style. [#647367]
Morten:
* Plug leaks.
diff --git a/goffice/graph/gog-legend.c b/goffice/graph/gog-legend.c
index 0b8a532..4a69ece 100644
--- a/goffice/graph/gog-legend.c
+++ b/goffice/graph/gog-legend.c
@@ -479,7 +479,7 @@ cb_render_elements (unsigned index, GOStyle const *base_style, char const *name,
gog_renderer_stroke_serie (renderer, line_path);
go_path_free (line_path);
gog_renderer_draw_marker (renderer, data->x + data->swatch.w * GLV_LINE_LENGTH_EM * 0.5, y);
- } else { /* area swatch */
+ } else if (base_style->interesting_fields & GO_STYLE_FILL) { /* area swatch */
style = go_style_dup (base_style);
if (style->line.width > data->hairline_width)
style->line.width =
@@ -492,6 +492,19 @@ cb_render_elements (unsigned index, GOStyle const *base_style, char const *name,
gog_renderer_push_style (renderer, style);
gog_renderer_draw_rectangle (renderer, &rectangle);
+ } else if (base_style->interesting_fields & GO_STYLE_MARKER) { /* markers only */
+ style = go_style_dup (base_style);
+ g_return_if_fail (style != NULL);
+ y = data->y + glv->element_height / 2.;
+ gog_renderer_push_style (renderer, style);
+ go_marker_set_size (style->marker.mark,
+ go_marker_get_size (style->marker.mark) *
+ data->swatch_scale_a + data->swatch_scale_b);
+ /* Might be not the best horizontal position, but seems to work not that bad */
+ gog_renderer_draw_marker (renderer, data->x + glv->label_offset * 0.5, y);
+ } else {
+ g_warning ("Series with no valid style in legend? Please file a bug report.");
+ return;
}
gog_renderer_pop_style (renderer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]