[gnumeric] Fix histogram tool for the case of no labels. [#795475]



commit dc80e06b519db47cbe066d12b854ba5a2a575b30
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Apr 24 14:57:15 2018 -0600

    Fix histogram tool for the case of no labels. [#795475]
    
    2018-04-24  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * analysis-histogram.c (analysis_tool_histogram_engine_run): shorten the source only
        in the presence of labels

 NEWS                           |    3 +++
 src/tools/ChangeLog            |    5 +++++
 src/tools/analysis-histogram.c |   17 +++++++++--------
 3 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8da2148..af5b16f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 Gnumeric 1.12.40
 
+Andreas:
+       * Fix histogram tool for the case of no labels. [#795475]
+
 Dean McCarron:
        * Introspection fixes.
 
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index eb2eaa2..397de86 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-24  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * analysis-histogram.c (analysis_tool_histogram_engine_run): shorten the source only
+       in the presence of labels
+
 2018-03-13  Morten Welinder <terra gnome org>
 
        * Release 1.12.39
diff --git a/src/tools/analysis-histogram.c b/src/tools/analysis-histogram.c
index fa089ac..1261f7e 100644
--- a/src/tools/analysis-histogram.c
+++ b/src/tools/analysis-histogram.c
@@ -197,14 +197,15 @@ analysis_tool_histogram_engine_run (data_analysis_output_t *dao,
                GnmExpr const *expr_min;
                GnmExpr const *expr_max;
 
-               switch (info->base.group_by) {
-               case GROUPED_BY_ROW:
-                       val->v_range.cell.a.col++;
-                       break;
-               default:
-                       val->v_range.cell.a.row++;
-                       break;
-               }
+               if (info->base.labels)
+                       switch (info->base.group_by) {
+                       case GROUPED_BY_ROW:
+                               val->v_range.cell.a.col++;
+                               break;
+                       default:
+                               val->v_range.cell.a.row++;
+                               break;
+                       }
 
                if (info->min_given)
                        dao_set_cell_float (dao, to_col, i_start, info->min);


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