[goffice] Fix rendering of matrix plots with a discrete axis.



commit 5f810ab69238b1368584d69a3d6e5a183533fb39
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Mar 10 14:54:42 2015 +0100

    Fix rendering of matrix plots with a discrete axis.

 ChangeLog                         |    6 ++++++
 plugins/plot_surface/gog-matrix.c |    8 ++++----
 plugins/plot_surface/gog-xyz.c    |    2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fc682d7..e860053 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2015-03-10  Jean Brefort  <jean brefort normalesup org>
 
+       * plugins/plot_surface/gog-matrix.c (gog_matrix_view_render): fix rendering
+       of matrix plots with a discrete axis.
+       * plugins/plot_surface/gog-xyz.c (gog_xyz_plot_axis_get_bounds): ditto.
+
+2015-03-10  Jean Brefort  <jean brefort normalesup org>
+
        * goffice/graph/gog-axis-line.c (axis_line_get_bbox),
        (axis_line_render): ensure that ticks on limits are not hidden because of
        rounding errors.
diff --git a/plugins/plot_surface/gog-matrix.c b/plugins/plot_surface/gog-matrix.c
index 3d7373f..cb6dfc3 100644
--- a/plugins/plot_surface/gog-matrix.c
+++ b/plugins/plot_surface/gog-matrix.c
@@ -180,8 +180,8 @@ gog_matrix_view_render (GogView *view, GogViewAllocation const *bbox)
 
        for (j = 0; j < jmax; j++) {
                if (xdiscrete) {
-                       rect.x = gog_axis_map_to_view (x_map, j);
-                       rect.w = gog_axis_map_to_view (x_map, j + 1) - rect.x;
+                       rect.x = gog_axis_map_to_view (x_map, j + 1);
+                       rect.w = gog_axis_map_to_view (x_map, j + 2) - rect.x;
                } else {
                        rect.x = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j));
                        rect.w = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j + 1)) - 
rect.x;
@@ -189,8 +189,8 @@ gog_matrix_view_render (GogView *view, GogViewAllocation const *bbox)
 
                for (i = 0; i < imax; i++) {
                        if (ydiscrete) {
-                               rect.y = gog_axis_map_to_view (y_map, i);
-                               rect.h = gog_axis_map_to_view (y_map, i + 1) - rect.y;
+                               rect.y = gog_axis_map_to_view (y_map, i + 1);
+                               rect.h = gog_axis_map_to_view (y_map, i + 2) - rect.y;
                        } else {
                                rect.y = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, i));
                                rect.h = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, i + 
1)) - rect.y;
diff --git a/plugins/plot_surface/gog-xyz.c b/plugins/plot_surface/gog-xyz.c
index 4848682..21bf143 100644
--- a/plugins/plot_surface/gog-xyz.c
+++ b/plugins/plot_surface/gog-xyz.c
@@ -308,6 +308,8 @@ gog_xyz_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
                (axis == GOG_AXIS_X && !xyz->transposed)) ?
                        series->columns:
                        series->rows;
+               if (GOG_IS_MATRIX_PLOT (plot))
+                       bounds->val.maxima++;
        }
        return (GOData*) vec;
 }


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