[gnumeric] Add probability plot to normality tool output.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Add probability plot to normality tool output.
- Date: Thu, 26 Nov 2009 08:02:59 +0000 (UTC)
commit 4f87054ae858c29b2a85d22b927ce81555348cc2
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Nov 26 01:02:12 2009 -0700
Add probability plot to normality tool output.
2009-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* normality-tests.glade: enable chart checkbox
2009-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* analysis-normality.c (analysis_tool_normality_engine_run):
create chart if requested
src/dialogs/ChangeLog | 4 +++
src/dialogs/normality-tests.glade | 3 +-
src/tools/ChangeLog | 5 ++++
src/tools/analysis-normality.c | 41 +++++++++++++++++++++++++++++++++++++
4 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 4b90f93..e09aeed 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * normality-tests.glade: enable chart checkbox
+
2009-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* normality-tests.glade: add more test seelction buttons
diff --git a/src/dialogs/normality-tests.glade b/src/dialogs/normality-tests.glade
index e5bd7b6..fc5026c 100644
--- a/src/dialogs/normality-tests.glade
+++ b/src/dialogs/normality-tests.glade
@@ -285,7 +285,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="sensitive">False</property>
+ <property name="sensitive">True</property>
+ <property name="active">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 8b5c792..6f61196 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * analysis-normality.c (analysis_tool_normality_engine_run):
+ create chart if requested
+
2009-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* analysis-normality.h (analysis_tools_data_normality_t):
diff --git a/src/tools/analysis-normality.c b/src/tools/analysis-normality.c
index 5982f3c..c97e23c 100644
--- a/src/tools/analysis-normality.c
+++ b/src/tools/analysis-normality.c
@@ -53,6 +53,10 @@ analysis_tool_normality_engine_run (data_analysis_output_t *dao,
char const *testname;
char const *n_comment;
+ GogGraph *graph;
+ GogPlot *plot;
+ SheetObject *so;
+
switch (info->type) {
case normality_test_type_andersondarling:
fdname = "ADTEST";
@@ -93,6 +97,24 @@ analysis_tool_normality_engine_run (data_analysis_output_t *dao,
dao_set_italic (dao, 0, 0, 0, 5);
dao_set_cell (dao, 0, 0, _(testname));
+
+ if (info->graph) {
+ GogChart *chart;
+
+ graph = g_object_new (GOG_TYPE_GRAPH, NULL);
+ chart = GOG_CHART (gog_object_add_by_name (
+ GOG_OBJECT (graph), "Chart", NULL));
+
+ plot = gog_plot_new_by_name ("GogProbabilityPlot");
+ go_object_set_property (G_OBJECT (plot), "distribution",
+ "Distribution", "GODistNormal",
+ NULL, NULL);
+
+ gog_object_add_by_name (GOG_OBJECT (chart),
+ "Plot", GOG_OBJECT (plot));
+ }
+
+
/* xgettext:
* Note to translators: in the following string and others like it,
* the "/" is a separator character that can be changed to anything
@@ -115,6 +137,17 @@ analysis_tool_normality_engine_run (data_analysis_output_t *dao,
dao_set_italic (dao, col, 0, col, 0);
analysis_tools_write_label (val_org, dao, &info->base,
col, 0, col);
+ if (info->graph) {
+ GogSeries *series;
+
+ series = gog_plot_new_series (plot);
+ gog_series_set_dim (series, 0,
+ gnm_go_data_vector_new_expr
+ (val_org->v_range.cell.a.sheet,
+ gnm_expr_top_new (gnm_expr_new_constant (value_dup (val_org)))),
+ NULL);
+ }
+
if (col == 1)
dao_set_cell_float (dao, col, 1, info->alpha);
else
@@ -133,6 +166,14 @@ analysis_tool_normality_engine_run (data_analysis_output_t *dao,
gnm_expr_new_constant (value_new_string (_("Possibly normal")))));
}
+ if (info->graph) {
+ so = sheet_object_graph_new (graph);
+ g_object_unref (graph);
+
+ dao_set_sheet_object (dao, 0, 1, so);
+ }
+
+
gnm_func_unref (fd);
gnm_func_unref (fd_if);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]