[goffice] Fix crossing axis position. [#45]



commit e862b8023b5bcb629dc6a244d449cda36675e9cc
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Apr 28 16:05:32 2020 +0200

    Fix crossing axis position. [#45]

 ChangeLog                     | 5 +++++
 NEWS                          | 1 +
 goffice/graph/gog-axis-line.c | 7 +++++++
 3 files changed, 13 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 8788854e..e9fdca59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-28  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/graph/gog-axis-line.c
+       (gog_axis_base_get_clamped_position): fix crossing axis position. [#45]
+
 2020-04-19  Morten Welinder  <terra gnome org>
 
        * goffice/gtk/goffice-gtk.c (cb_format_combo_changed): Take
diff --git a/NEWS b/NEWS
index a05b40c7..a153c2c3 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Jean:
        * Ensure that all required dims have valid data in a valid series. [#466]
        * Fix legend order in bar plots.
        * Test plot series validity after a data change. [#468] 
+       * Fix crossing axis position. [#45]
 
 Morten:
        * Fix library namespace issue.
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index fdfd9192..57465e88 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -1,3 +1,4 @@
+
 /*
  * gog-axis-line.c :
  *
@@ -416,10 +417,16 @@ gog_axis_base_get_clamped_position (GogAxisBase *axis_base)
                        return GOG_AXIS_AUTO;
                cross_location = gog_axis_base_get_cross_location (axis_base);
                if (gog_axis_get_bounds (cross_axis, &minimum, &maximum)) {
+                       double start, end;
+                       gog_axis_get_effective_span (cross_axis, &start, &end);
                        if (go_sub_epsilon (cross_location - minimum) <= 0.0)
                                axis_pos = gog_axis_is_inverted (cross_axis) ? GOG_AXIS_AT_HIGH : 
GOG_AXIS_AT_LOW;
                        else if (go_add_epsilon (cross_location - maximum) >= 0.0)
                                axis_pos = gog_axis_is_inverted (cross_axis) ? GOG_AXIS_AT_LOW : 
GOG_AXIS_AT_HIGH;
+                       if (axis_pos == GOG_AXIS_AT_LOW && start > 0.)
+                               return GOG_AXIS_CROSS;
+                       if (axis_pos == GOG_AXIS_AT_HIGH && end < 1.)
+                               return GOG_AXIS_CROSS;
                }
        }
 


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