[goffice] Ensure that all required dims have valid data in a valid series. [#466]



commit c9613514fd996859274d0639e768aba4dbc925a1
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Apr 9 08:07:11 2020 +0200

    Ensure that all required dims have valid data in a valid series. [#466]

 ChangeLog                      | 9 +++++++++
 NEWS                           | 2 ++
 goffice/graph/gog-series.c     | 5 +++--
 plugins/plot_barcol/gog-1.5d.c | 5 ++++-
 4 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 74130b65..caae4fe2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-04-09  Jean Brefort  <jean brefort normalesup org>
+
+       reviewed by: <delete if not using a buddy>
+
+       * goffice/graph/gog-series.c (gog_series_check_validity): ensure all
+       required dims has valid data. Fix #466.
+       * plugins/plot_barcol/gog-1.5d.c (gog_1_5d_enum_in_reverse): fix legend
+       order in bar plots.
+
 2020-03-09  Morten Welinder  <terra gnome org>
 
        * goffice/utils/go-file.c (go_url_check_extension): Make new_uri
diff --git a/NEWS b/NEWS
index 86f3a5f0..e943517a 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Jean:
        * Fix crash if a XY plot series has data labels but no valid data. [#426]
        * Fix criticals related to data labels. [#428]
        * Fix a drawing error in contour plots. [#458]
+       * Ensure that all required dims have valid data in a valid series. [#466]
+       * Fix legend order in bar plots.
 
 Morten:
        * Fix library namespace issue.
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index 7eb7753d..93cab8c5 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -1024,8 +1024,9 @@ gog_series_check_validity (GogSeries *series)
 
        desc = &series->plot->desc.series;
        for (i = series->plot->desc.series.num_dim; i-- > 0; )
-               if (series->values[i].data == NULL &&
-                   desc->dim[i].priority == GOG_SERIES_REQUIRED) {
+               if (desc->dim[i].priority == GOG_SERIES_REQUIRED && (
+                     series->values[i].data == NULL ||
+                     !go_data_has_value (series->values[i].data))) {
                        series->is_valid = FALSE;
                        return;
                }
diff --git a/plugins/plot_barcol/gog-1.5d.c b/plugins/plot_barcol/gog-1.5d.c
index b0e1a83c..6ec58b6e 100644
--- a/plugins/plot_barcol/gog-1.5d.c
+++ b/plugins/plot_barcol/gog-1.5d.c
@@ -333,7 +333,10 @@ static gboolean
 gog_1_5d_enum_in_reverse (GogPlot const *plot)
 {
        GogPlot1_5d *gog_1_5d = GOG_PLOT1_5D (plot);
-       return gog_1_5d->type != GOG_1_5D_NORMAL; /* stacked or percentage */
+       GogPlot1_5dClass *klass = GOG_PLOT1_5D_GET_CLASS (plot);
+       return (gog_1_5d->type != GOG_1_5D_NORMAL && /* stacked or percentage */
+               ((klass->swap_x_and_y == NULL) || (!(*klass->swap_x_and_y ) (gog_1_5d))));
+                       /* the value axis is the Y-axis, not the X-axis */
 }
 
 static void


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