[gnumeric] Minor histogram improvements.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Minor histogram improvements.
- Date: Fri, 18 Feb 2011 08:00:50 +0000 (UTC)
commit a4bae018ffd5d1b7bd0645242eb0c161e20c088d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri Feb 18 01:04:39 2011 -0700
Minor histogram improvements.
2011-02-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* histogram.ui: add checkbox
* dialog-analysis-tools.c (histogram_tool_ok_clicked_cb): read new
checkbox
2011-02-18 Andreas J. Guelzow <aguelzow pyrshep ca>
* analysis-histogram.h (analysis_tools_data_histogram_t): add field
* analysis-histogram.c (make_hist_expr): ignore blanks and restrict to
numbers if requested
NEWS | 1 +
src/dialogs/ChangeLog | 6 +++++
src/dialogs/dialog-analysis-tools.c | 2 +
src/dialogs/histogram.ui | 39 +++++++++++++++++++++-------------
src/tools/ChangeLog | 6 +++++
src/tools/analysis-histogram.c | 34 +++++++++++++++++++++++++-----
src/tools/analysis-histogram.h | 1 +
7 files changed, 68 insertions(+), 21 deletions(-)
---
diff --git a/NEWS b/NEWS
index ac810cf..796ae91 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Andreas:
* Fix width of translated lists in various dialogs [#641626]
* Allow function tooltips to be closed temporarily [#641355]
* Import & export list validation from and to ODF files. [#640701]
+ * Minor histogram improvements.
Jean:
* Fix cursor position inside a cell edited in a zoomed sheet. [#641709]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 11991b7..b9c801b 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * histogram.ui: add checkbox
+ * dialog-analysis-tools.c (histogram_tool_ok_clicked_cb): read new
+ checkbox
+
2011-02-05 Andreas J. Guelzow <aguelzow pyrshep ca>
* doc-meta-data.ui: don't fix the width of the selection list
diff --git a/src/dialogs/dialog-analysis-tools.c b/src/dialogs/dialog-analysis-tools.c
index f5a1d88..642188c 100644
--- a/src/dialogs/dialog-analysis-tools.c
+++ b/src/dialogs/dialog-analysis-tools.c
@@ -3283,6 +3283,8 @@ histogram_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
data->percentage = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
w = go_gtk_builder_get_widget (state->base.gui, "cum-button");
data->cumulative = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
+ w = go_gtk_builder_get_widget (state->base.gui, "only-num-button");
+ data->only_numbers = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
dao, data, analysis_tool_histogram_engine, TRUE))
diff --git a/src/dialogs/histogram.ui b/src/dialogs/histogram.ui
index 06ef1f9..9d826f2 100644
--- a/src/dialogs/histogram.ui
+++ b/src/dialogs/histogram.ui
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
@@ -6,11 +6,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes">Histogram</property>
<property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkNotebook" id="notebook1">
@@ -20,7 +18,6 @@
<child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkTable" id="input-table">
<property name="visible">True</property>
@@ -168,7 +165,6 @@
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="border_width">12</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkTable" id="table2">
<property name="visible">True</property>
@@ -367,10 +363,9 @@
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="bintype_pm_inf_upper">
- <property name="label" translatable="yes">(−∞,∙), [∙,∙), ⋯, [∙,∙), [∙,∞)</property>
+ <property name="label" translatable="yes">(â??â??,â??), [â??,â??), â?¯, [â??,â??), [â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -383,7 +378,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_pm_inf_lower">
- <property name="label" translatable="yes">(−∞,∙], (∙,∙], ⋯, (∙,∙], (∙,∞)</property>
+ <property name="label" translatable="yes">(â??â??,â??], (â??,â??], â?¯, (â??,â??], (â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -406,7 +401,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_p_inf_upper">
- <property name="label" translatable="yes">[∙,∙),[∙,∙),⋯,[∙,∙),[∙,∞)</property>
+ <property name="label" translatable="yes">[â??,â??),[â??,â??),â?¯,[â??,â??),[â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -420,7 +415,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_p_inf_lower">
- <property name="label" translatable="yes">(∙,∙],(∙,∙],⋯,(∙,∙],(∙,∞)</property>
+ <property name="label" translatable="yes">(â??,â??],(â??,â??],â?¯,(â??,â??],(â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -434,7 +429,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_m_inf_upper">
- <property name="label" translatable="yes">(−∞,∙),[∙,∙),⋯,[∙,∙),[∙,∙)</property>
+ <property name="label" translatable="yes">(â??â??,â??),[â??,â??),â?¯,[â??,â??),[â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -448,7 +443,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_m_inf_lower">
- <property name="label" translatable="yes">(−∞,∙],(∙,∙],⋯,(∙,∙],(∙,∙]</property>
+ <property name="label" translatable="yes">(â??â??,â??],(â??,â??],â?¯,(â??,â??],(â??,â??]</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -471,7 +466,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_no_inf_upper">
- <property name="label" translatable="yes">[∙,∙),[∙,∙),⋯,[∙,∙),[∙,∙)</property>
+ <property name="label" translatable="yes">[â??,â??),[â??,â??),â?¯,[â??,â??),[â??,â??)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -485,7 +480,7 @@
</child>
<child>
<object class="GtkRadioButton" id="bintype_no_inf_lower">
- <property name="label" translatable="yes">(∙,∙],(∙,∙],⋯,(∙,∙],(∙,∙]</property>
+ <property name="label" translatable="yes">(â??,â??],(â??,â??],â?¯,(â??,â??],(â??,â??]</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -517,7 +512,6 @@
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="border_width">12</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkRadioButton" id="nochart-button">
@@ -619,6 +613,21 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="only-num-button">
+ <property name="label" translatable="yes">Count numbers only</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 9be681d..6fa15c9 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * analysis-histogram.h (analysis_tools_data_histogram_t): add field
+ * analysis-histogram.c (make_hist_expr): ignore blanks and restrict to
+ numbers if requested
+
2011-02-02 Morten Welinder <terra gnome org>
* Release 1.10.13
diff --git a/src/tools/analysis-histogram.c b/src/tools/analysis-histogram.c
index d971b2d..d4b77c0 100644
--- a/src/tools/analysis-histogram.c
+++ b/src/tools/analysis-histogram.c
@@ -51,7 +51,11 @@ make_hist_expr (analysis_tools_data_histogram_t *info,
GnmExprOp from, to;
GnmFunc *fd_if = gnm_func_lookup_or_add_placeholder ("IF", dao->sheet ? dao->sheet->workbook : NULL, FALSE);
GnmFunc *fd_sum = gnm_func_lookup_or_add_placeholder ("SUM", dao->sheet ? dao->sheet->workbook : NULL, FALSE);
- GnmFunc *fd_count = gnm_func_lookup_or_add_placeholder ("COUNT", dao->sheet ? dao->sheet->workbook : NULL, FALSE);
+ GnmFunc *fd_count = info->percentage ?
+ gnm_func_lookup_or_add_placeholder (info->only_numbers ? "COUNT" : "COUNTA",
+ dao->sheet ? dao->sheet->workbook : NULL, FALSE) : NULL;
+ GnmFunc *fd_isnumber = gnm_func_lookup_or_add_placeholder (info->only_numbers ? "ISNUMBER" : "ISBLANK",
+ dao->sheet ? dao->sheet->workbook : NULL, FALSE);
gint to_col = (info->cumulative) ? 0 : 1;
if (info->bin_type & bintype_no_inf_upper) {
@@ -75,7 +79,7 @@ make_hist_expr (analysis_tools_data_histogram_t *info,
gnm_expr_new_constant (value_new_int (1)));
if (info->cumulative)
- expr = gnm_expr_new_funcall1 (fd_sum, expr_if_to);
+ expr = expr_if_to;
else {
GnmExpr const *one = gnm_expr_new_constant (value_new_int (1));
if (fromminf)
@@ -88,13 +92,31 @@ make_hist_expr (analysis_tools_data_histogram_t *info,
from, make_cellref (- col, 0)),
gnm_expr_new_constant (value_new_int (0)),
one);
- expr = gnm_expr_new_funcall1
- (fd_sum,
- gnm_expr_new_binary (expr_if_from,
+ expr = gnm_expr_new_binary (expr_if_from,
GNM_EXPR_OP_MULT,
- expr_if_to));
+ expr_if_to);
}
+ if (info->only_numbers)
+ expr = gnm_expr_new_binary (expr,
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall3
+ (fd_if,gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_data)),
+ gnm_expr_new_constant (value_new_int (1)),
+ gnm_expr_new_constant (value_new_int (0))));
+ else
+ expr = gnm_expr_new_binary (expr,
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall3
+ (fd_if,gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_data)),
+ gnm_expr_new_constant (value_new_int (0)),
+ gnm_expr_new_constant (value_new_int (1))));
+
+
+ expr = gnm_expr_new_funcall1 (fd_sum, expr);
+
if (info->percentage)
expr = gnm_expr_new_binary (expr,
GNM_EXPR_OP_DIV,
diff --git a/src/tools/analysis-histogram.h b/src/tools/analysis-histogram.h
index ef87434..1c747a5 100644
--- a/src/tools/analysis-histogram.h
+++ b/src/tools/analysis-histogram.h
@@ -66,6 +66,7 @@ typedef struct {
gint n;
gboolean percentage;
gboolean cumulative;
+ gboolean only_numbers;
chart_t chart;
} analysis_tools_data_histogram_t;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]