gnumeric r16805 - in trunk/src: dialogs tools
- From: guelzow svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16805 - in trunk/src: dialogs tools
- Date: Thu, 18 Sep 2008 03:30:30 +0000 (UTC)
Author: guelzow
Date: Thu Sep 18 03:30:30 2008
New Revision: 16805
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16805&view=rev
Log:
2008-09-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* histogram.glade: enable chart buttons and rearrange them
* dialog-analysis-tools.c (chart_group): new
(histogram_tool_update_sensitivity_cb): remove unused variables
(histogram_tool_ok_clicked_cb): handle all chart radio buttons
(histogram_tool_set_predetermined_on_toggle): delete
2008-09-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* dao.c (dao_set_sheet_object): don't make the graph too big
* analysis-histogram.c (analysis_tool_histogram_engine_run): handle
bar and column chart request
Modified:
trunk/src/dialogs/ChangeLog
trunk/src/dialogs/dialog-analysis-tools.c
trunk/src/dialogs/histogram.glade
trunk/src/tools/ChangeLog
trunk/src/tools/analysis-histogram.c
trunk/src/tools/dao.c
Modified: trunk/src/dialogs/dialog-analysis-tools.c
==============================================================================
--- trunk/src/dialogs/dialog-analysis-tools.c (original)
+++ trunk/src/dialogs/dialog-analysis-tools.c Thu Sep 18 03:30:30 2008
@@ -108,6 +108,13 @@
NULL
};
+static char const * const chart_group[] = {
+ "nochart-button",
+ "histogram-button",
+ "barchart-button",
+ "columnchart-button",
+ NULL
+};
typedef struct {
@@ -2443,11 +2450,6 @@
histogram_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
HistogramToolState *state)
{
- gboolean ready = FALSE;
- gboolean input_ready = FALSE;
- gboolean bin_ready = FALSE;
- gboolean output_ready = FALSE;
-
int the_n;
gboolean predetermined_bins;
GSList *input_range;
@@ -2539,6 +2541,7 @@
}
data->bin_type = gnumeric_glade_group_value (state->base.gui, bin_type_group);
+ data->chart = gnumeric_glade_group_value (state->base.gui, chart_group);
w = glade_xml_get_widget (state->base.gui, "labels_button");
data->base.labels = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
@@ -2546,11 +2549,6 @@
data->percentage = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
w = glade_xml_get_widget (state->base.gui, "cum-button");
data->cumulative = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
- w = glade_xml_get_widget (state->base.gui, "chart-button");
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
- data->chart = HISTOGRAM_CHART;
- else
- data->chart = NO_CHART;
if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
dao, data, analysis_tool_histogram_engine))
@@ -2578,20 +2576,6 @@
}
/**
- * histogram_tool_set_predetermined_on_toggle:
- * @widget:
- * @state:
- *
- **/
-static void
-histogram_tool_set_predetermined_on_toggle (G_GNUC_UNUSED GtkWidget *widget,
- HistogramToolState *state)
-{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->predetermined_button), TRUE);
-}
-
-
-/**
* histogram_tool_set_calculated:
* @widget:
* @event:
Modified: trunk/src/dialogs/histogram.glade
==============================================================================
--- trunk/src/dialogs/histogram.glade (original)
+++ trunk/src/dialogs/histogram.glade Thu Sep 18 03:30:30 2008
@@ -17,114 +17,131 @@
<property name="can_focus">True</property>
<property name="border_width">5</property>
<child>
- <widget class="GtkTable" id="input-table">
+ <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <placeholder/>
- </child>
<child>
- <widget class="GtkCheckButton" id="labels_button">
+ <widget class="GtkTable" id="input-table">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Labels</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <property name="homogeneous">True</property>
+ <property name="border_width">12</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
<child>
- <widget class="GtkRadioButton" id="grouped_by_col">
+ <widget class="GtkLabel" id="var1-label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Columns</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes">Input _range:</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
</child>
<child>
- <widget class="GtkRadioButton" id="grouped_by_row">
+ <widget class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Rows</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">grouped_by_col</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes">Grouped by:</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkRadioButton" id="grouped_by_col">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Columns</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="grouped_by_row">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Rows</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">grouped_by_col</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="grouped_by_area">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Areas</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">grouped_by_col</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="grouped_by_area">
+ <widget class="GtkCheckButton" id="labels_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Areas</property>
+ <property name="label" translatable="yes">_Labels</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">grouped_by_col</property>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
</widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
</child>
<child>
- <widget class="GtkLabel" id="label1">
+ <widget class="GtkHSeparator" id="hseparator4">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">Grouped by:</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="expand">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="var1-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">Input _range:</property>
- <property name="use_underline">True</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- </widget>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
+ <placeholder/>
</child>
</widget>
</child>
@@ -158,8 +175,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_padding">2</property>
</packing>
@@ -173,8 +190,8 @@
<property name="mnemonic_widget">min_entry</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="x_padding">5</property>
@@ -189,8 +206,8 @@
<property name="mnemonic_widget">n_entry</property>
</widget>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="x_padding">5</property>
@@ -205,8 +222,8 @@
<property name="mnemonic_widget">max_entry</property>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="x_padding">5</property>
@@ -221,8 +238,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="y_options"></property>
<property name="y_padding">2</property>
</packing>
@@ -236,8 +253,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="y_options"></property>
<property name="y_padding">2</property>
</packing>
@@ -246,7 +263,7 @@
<widget class="GtkRadioButton" id="calculated_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Calculated cutoffs</property>
+ <property name="label" translatable="yes">C_alculated cutoffs</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property>
@@ -477,11 +494,10 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label5">
+ <widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">_Bins</property>
<property name="use_underline">True</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
<property name="type">tab</property>
@@ -495,12 +511,12 @@
<property name="border_width">12</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton" id="percentage-button">
+ <widget class="GtkRadioButton" id="nochart-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Percentages</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">No chart</property>
<property name="response_id">0</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
@@ -509,13 +525,13 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="cum-button">
+ <widget class="GtkRadioButton" id="barchart-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">C_umulative answers</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Bar chart</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
+ <property name="group">nochart-button</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -524,13 +540,13 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="chart-button">
+ <widget class="GtkRadioButton" id="columnchart-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Chart output</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Column chart</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
+ <property name="group">nochart-button</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -539,67 +555,13 @@
</packing>
</child>
<child>
- <widget class="GtkTable" id="table1">
+ <widget class="GtkRadioButton" id="histogram-button">
<property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">20</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <widget class="GtkRadioButton" id="columnchart-button">
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Column chart</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">barchart-button</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="histogram-button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Histogram chart</property>
- <property name="response_id">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">barchart-button</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="barchart-button">
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Bar chart</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Histogram chart</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">nochart-button</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -607,6 +569,48 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator5">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="percentage-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Percentages</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="cum-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">C_umulative answers</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">3</property>
@@ -615,7 +619,7 @@
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="label" translatable="yes">O_ptions</property>
+ <property name="label" translatable="yes">_Graphs & Options</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
@@ -637,10 +641,11 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label6">
+ <widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">_Output</property>
<property name="use_underline">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
<property name="type">tab</property>
Modified: trunk/src/tools/analysis-histogram.c
==============================================================================
--- trunk/src/tools/analysis-histogram.c (original)
+++ trunk/src/tools/analysis-histogram.c Thu Sep 18 03:30:30 2008
@@ -39,6 +39,9 @@
#include <goffice/graph/gog-graph.h>
#include <goffice/graph/gog-object.h>
#include <goffice/graph/gog-chart.h>
+#include <goffice/graph/gog-plot.h>
+#include <goffice/graph/gog-series.h>
+#include <goffice/utils/go-glib-extras.h>
static gboolean
analysis_tool_histogram_engine_run (data_analysis_output_t *dao,
@@ -316,49 +319,58 @@
gnm_func_unref (fd_count);
/* Create Chart if requested */
-
- switch (info->chart) {
+ if (info->chart != NO_CHART) {
SheetObject *so;
GogGraph *graph;
GogChart *chart;
GogPlot *plot;
GogSeries *series;
+ gint limits_start, limits_end, values_start, values_end;
GOData *limits;
GOData *values;
int ct;
-
- case HISTOGRAM_CHART:
+
graph = g_object_new (GOG_GRAPH_TYPE, NULL);
chart = GOG_CHART (gog_object_add_by_name (
- GOG_OBJECT (graph), "Chart", NULL));
- plot = gog_plot_new_by_name ("GogHistogramPlot");
+ GOG_OBJECT (graph), "Chart", NULL));
+
+ if (info->chart == HISTOGRAM_CHART) {
+ plot = gog_plot_new_by_name ("GogHistogramPlot");
+ limits_start = i_start;
+ limits_end = i_start + i_limit - 1;
+ values_start = i_start + 1;
+ values_end = i_start + i_limit - 1;
+ } else {
+ plot = gog_plot_new_by_name ("GogBarColPlot");
+ limits_start = 2;
+ limits_end = i_end;
+ values_start = 2;
+ values_end = i_end;
+ if (info->chart == BAR_CHART)
+ go_object_toggle (plot, "horizontal");
+ }
+
gog_object_add_by_name (GOG_OBJECT (chart),
"Plot", GOG_OBJECT (plot));
-
- limits = dao_go_data_vector (dao, to_col, i_start, to_col,
- i_start + i_limit - 1);
+
+ limits = dao_go_data_vector (dao, to_col, limits_start,
+ to_col, limits_end);
for (ct = 1; ct < (col - to_col); ct ++) {
g_object_ref (limits);
- values = dao_go_data_vector (dao, to_col + ct, i_start + 1,
- to_col + ct, i_start + i_limit - 1);
+ values = dao_go_data_vector (dao, to_col + ct, values_start,
+ to_col + ct, values_end);
series = gog_plot_new_series (plot);
gog_series_set_dim (series, 0, limits, NULL);
gog_series_set_dim (series, 1, values, NULL);
}
g_object_unref (limits);
-
+
so = sheet_object_graph_new (graph);
g_object_unref (graph);
-
+
dao_set_sheet_object (dao, 0, 1, so);
- break;
- case BAR_CHART: /* not yet implemented */
- case COLUMN_CHART: /* not yet implemented */
- case NO_CHART:
- default:
- break;
}
dao_redraw_respan (dao);
Modified: trunk/src/tools/dao.c
==============================================================================
--- trunk/src/tools/dao.c (original)
+++ trunk/src/tools/dao.c Thu Sep 18 03:30:30 2008
@@ -1158,8 +1158,8 @@
g_return_if_fail (so != NULL);
range_init (&anchor_r, dao->start_col + col, dao->start_row + row,
- dao->start_col + dao->cols - 1,
- dao->start_row + dao->rows - 1);
+ dao->start_col + ((dao->cols < 5) ? dao->cols : 5),
+ dao->start_row + ((dao->rows < 10) ? dao->rows : 10));
sheet_object_anchor_init (&anchor, &anchor_r, 0, GOD_ANCHOR_DIR_UNKNOWN);
sheet_object_set_anchor (so, &anchor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]