[gnumeric] better xls surface plot import.
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] better xls surface plot import.
- Date: Sat, 5 Sep 2009 05:31:58 +0000 (UTC)
commit d5ee9103d7543080831c2f634d995ced59a90d1f
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Sep 5 07:31:24 2009 +0200
better xls surface plot import.
plugins/excel/ChangeLog | 5 +++
plugins/excel/ms-chart.c | 79 +++++++++++++++++++++++++--------------------
2 files changed, 49 insertions(+), 35 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index abb1c5b..b966940 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-05 Jean Brefort <jean brefort normalesup org>
+
+ * ms-chart.c (end): don't use z values as x or y when there are no
+ labels or categories. [See #593937]
+
2009-09-04 Jean Brefort <jean brefort normalesup org>
* ms-chart.c (axis), (xl_axis_get_elem), (valuerange): use gnm_go_data
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index a177d51..6e867b1 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -2542,11 +2542,11 @@ BC_R(end)(XLChartHandler const *handle,
GogSeries *series;
GOStyle *style;
gboolean plot_has_lines = FALSE, plot_has_marks = FALSE;
+ GnmExprTop const *cat_expr = NULL;
/* check series now and create 3d plot if necessary */
if (s->is_surface) {
- gboolean is_matrix = TRUE;
- GnmExprTop const *cat_expr = NULL;
+ gboolean is_matrix = TRUE, has_labels = FALSE;
GnmValue *value;
GnmRange vector;
gboolean as_col = FALSE; /* makes gcc happy */
@@ -2672,6 +2672,7 @@ BC_R(end)(XLChartHandler const *handle,
break;
}
value_release (value);
+ has_labels = TRUE;
}
cur = eseries->data [GOG_MS_DIM_CATEGORIES].data;
if (cur && cat_expr &&
@@ -2700,23 +2701,27 @@ BC_R(end)(XLChartHandler const *handle,
"transposed", TRUE,
NULL);
col --;
- vector.start.row = row;
- vector.start.col = vector.end.col = col_start;
- vector.end.row = last;
- gog_series_set_dim (series, 1,
- gnm_go_data_vector_new_expr (sheet,
- gnm_expr_top_new_constant (
- value_new_cellrange_r (sheet, &vector))), NULL);
- col_start++;
- vector.start.col = col_start;
- vector.start.row = vector.end.row = row_start;
- vector.end.col = col;
- gog_series_set_dim (series, 0,
- gnm_go_data_vector_new_expr (sheet,
- gnm_expr_top_new_constant (
- value_new_cellrange_r (sheet, &vector))), NULL);
-
- row_start++;
+ if (cat_expr != NULL) {
+ vector.start.row = row;
+ vector.start.col = vector.end.col = col_start;
+ vector.end.row = last;
+ gog_series_set_dim (series, 1,
+ gnm_go_data_vector_new_expr (sheet,
+ gnm_expr_top_new_constant (
+ value_new_cellrange_r (sheet, &vector))), NULL);
+ col_start++;
+ }
+ if (has_labels) {
+ vector.start.col = col_start;
+ vector.start.row = vector.end.row = row_start;
+ vector.end.col = col;
+ gog_series_set_dim (series, 0,
+ gnm_go_data_vector_new_expr (sheet,
+ gnm_expr_top_new_constant (
+ value_new_cellrange_r (sheet, &vector))), NULL);
+
+ row_start++;
+ }
vector.start.row = row_start;
vector.end.row = last;
gog_series_set_dim (series, 2,
@@ -2725,22 +2730,26 @@ BC_R(end)(XLChartHandler const *handle,
value_new_cellrange_r (sheet, &vector))), NULL);
} else {
row--;
- vector.start.col = col;
- vector.start.row = vector.end.row = row_start;
- vector.end.col = last;
- gog_series_set_dim (series, 0,
- gnm_go_data_vector_new_expr (sheet,
- gnm_expr_top_new_constant (
- value_new_cellrange_r (sheet, &vector))), NULL);
- row_start++;
- vector.start.row = row_start;
- vector.start.col = vector.end.col = col_start;
- vector.end.row = row;
- gog_series_set_dim (series, 1,
- gnm_go_data_vector_new_expr (sheet,
- gnm_expr_top_new_constant (
- value_new_cellrange_r (sheet, &vector))), NULL);
- col_start++;
+ if (cat_expr != NULL) {
+ vector.start.col = col;
+ vector.start.row = vector.end.row = row_start;
+ vector.end.col = last;
+ gog_series_set_dim (series, 0,
+ gnm_go_data_vector_new_expr (sheet,
+ gnm_expr_top_new_constant (
+ value_new_cellrange_r (sheet, &vector))), NULL);
+ row_start++;
+ }
+ if (has_labels) {
+ vector.start.row = row_start;
+ vector.start.col = vector.end.col = col_start;
+ vector.end.row = row;
+ gog_series_set_dim (series, 1,
+ gnm_go_data_vector_new_expr (sheet,
+ gnm_expr_top_new_constant (
+ value_new_cellrange_r (sheet, &vector))), NULL);
+ col_start++;
+ }
vector.start.col = col_start;
vector.end.col = last;
gog_series_set_dim (series, 2,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]