[goffice] Make data labels position independant on scale. [#694731]



commit ff8b727568b7eaa385c999d064d5eacde84ad550
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Feb 26 12:16:22 2013 +0100

    Make data labels position independant on scale. [#694731]

 ChangeLog                        |    6 ++++++
 NEWS                             |    1 +
 plugins/plot_barcol/gog-barcol.c |    1 +
 plugins/plot_xy/gog-xy.c         |    8 ++++----
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8976b67..2408478 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-02-26  Jean Brefort  <jean brefort normalesup org>
+
+       * plugins/plot_barcol/gog-barcol.c (gog_barcol_view_render): make data
+       labels position independant on scale. [#
+       * plugins/plot_xy/gog-xy.c (gog_xy_view_render):
+
 2013-02-24  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/graph/gog-styled-object.c (gog_style_new): returns GogStyle* to
diff --git a/NEWS b/NEWS
index 566741c..0b26a1d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Jean:
        * Add a user interface for radar and polar plots axis selection. [#692803]
        * Fix go_component_build_snapshot() returned value. [#694231]
        * Do not use invalid values in line plots. [#694232]
+       * Make data labels position independant on scale. [#694731]
 
 Morten:
        * Cleanup linear algebra.  [#691630]
diff --git a/plugins/plot_barcol/gog-barcol.c b/plugins/plot_barcol/gog-barcol.c
index 7a65e8b..50bd165 100644
--- a/plugins/plot_barcol/gog-barcol.c
+++ b/plugins/plot_barcol/gog-barcol.c
@@ -760,6 +760,7 @@ gog_barcol_view_render (GogView *view, GogViewAllocation const *bbox)
                                        g_object_get (labels[j], "offset", &offset, NULL);
                                        position = gog_series_labels_get_position (labels[j]);
                                }
+                               offset *= gog_renderer_get_scale (view->renderer);
                                switch (position) {
                                default:
                                case GOG_SERIES_LABELS_CENTERED:
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index b859751..455c711 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -1584,19 +1584,19 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
                                        anchor = GO_ANCHOR_CENTER;
                                        break;
                                case GOG_SERIES_LABELS_TOP:
-                                       alloc.y -= cur_offset;
+                                       alloc.y -= cur_offset * gog_renderer_get_scale (view->renderer);;
                                        anchor = GO_ANCHOR_SOUTH;
                                        break;
                                case GOG_SERIES_LABELS_BOTTOM:
-                                       alloc.y += cur_offset;
+                                       alloc.y += cur_offset * gog_renderer_get_scale (view->renderer);
                                        anchor = GO_ANCHOR_NORTH;
                                        break;
                                case GOG_SERIES_LABELS_LEFT:
-                                       alloc.x -= cur_offset;
+                                       alloc.x -= cur_offset * gog_renderer_get_scale (view->renderer);;
                                        anchor = GO_ANCHOR_EAST;
                                        break;
                                case GOG_SERIES_LABELS_RIGHT:
-                                       alloc.x += cur_offset;
+                                       alloc.x += cur_offset * gog_renderer_get_scale (view->renderer);;
                                        anchor = GO_ANCHOR_WEST;
                                        break;
                                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]