[goffice] Fixed axis title position.



commit 20053a07283f365940e78521964c741f1e0cb30c
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Sep 8 16:45:12 2011 +0200

    Fixed axis title position.

 ChangeLog                      |    6 ++++++
 NEWS                           |    2 +-
 goffice/graph/gog-axis.c       |    6 ++++--
 plugins/plot_barcol/gog-line.c |    2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e6b1e9b..7f65160 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-08  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/graph/gog-axis.c (gog_axis_view_size_allocate): fixed axis title
+	automatic position by taking actual axis span into account.
+	* plugins/plot_barcol/gog-line.c (gog_line_view_render): fixed are filling.
+
 2011-09-07  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* goffice/utils/go-format.h (go_format_set_build_in): new
diff --git a/NEWS b/NEWS
index 504f95f..6c61d34 100644
--- a/NEWS
+++ b/NEWS
@@ -17,7 +17,7 @@ Jean:
 	* Add a plugin directory for extern plugins, independent from micro version.
 	* Allow the frame around a chart label to rotate with the text. [647147]
 	* Chart labels accept rich text. [#417631]
-	* Axes can use only a part of available space. [#654392]
+	* Axes can use only a part of available space. [#654392][#513137]
 	* Add support for smoothed curve renaming. [#656148].
 	* Fix widgets position inside an RTL canvas.
 	* Fix minor ticks number. [#657670]
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 5289734..21d1b6f 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -3361,6 +3361,7 @@ gog_axis_view_size_allocate (GogView *view, GogViewAllocation const *bbox)
 	GogChart *chart = GOG_CHART (gog_object_get_parent (view->model));
 	double const pad_h = gog_renderer_pt2r_y (view->renderer, PAD_HACK);
 	double const pad_w = gog_renderer_pt2r_x (view->renderer, PAD_HACK);
+	double start, end;
 
 	available.w = bbox->w;
 	available.h = bbox->h;
@@ -3384,9 +3385,10 @@ gog_axis_view_size_allocate (GogView *view, GogViewAllocation const *bbox)
 						return;
 					}
 					gog_view_size_request (child, &available, &req);
+					gog_axis_get_effective_span (axis, &start, &end);
 					if (type == GOG_AXIS_X) {
 						child_bbox.x = plot_area->x +
-							(plot_area->w - req.w) / 2.0;
+							(plot_area->w * (start + end) - req.w) / 2.0;
 						child_bbox.w = req.w;
 						child_bbox.h = req.h;
 						switch (axis_pos) {
@@ -3402,7 +3404,7 @@ gog_axis_view_size_allocate (GogView *view, GogViewAllocation const *bbox)
 						tmp.h -= req.h + pad_h;
 					} else {
 						child_bbox.y = plot_area->y +
-							(plot_area->h - req.h) / 2.0;
+							(plot_area->h * (start + end) - req.h) / 2.0;
 						child_bbox.h = req.h;
 						child_bbox.w = req.w;
 						switch (axis_pos) {
diff --git a/plugins/plot_barcol/gog-line.c b/plugins/plot_barcol/gog-line.c
index cd23ded..0e368c2 100644
--- a/plugins/plot_barcol/gog-line.c
+++ b/plugins/plot_barcol/gog-line.c
@@ -744,7 +744,7 @@ gog_line_view_render (GogView *view, GogViewAllocation const *bbox)
 			if (type == GOG_1_5D_NORMAL || i == 0) {
 				GOPath *close_path = go_path_new ();
 				go_path_move_to (close_path, gog_axis_map_to_view (x_map, 1), y_zero);
-				go_path_line_to (close_path, gog_axis_map_to_view (x_map, lengths[i] + 1), y_zero);
+				go_path_line_to (close_path, gog_axis_map_to_view (x_map, lengths[i]), y_zero);
 				gog_renderer_fill_serie (view->renderer, paths[i], close_path);
 				gog_renderer_stroke_serie (view->renderer, close_path);
 				go_path_free (close_path);



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