[gnumeric] xlsx: save a view3D for contour plots.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: save a view3D for contour plots.
- Date: Thu, 26 Oct 2017 19:37:17 +0000 (UTC)
commit 57e64db4c04e9a9102aa8856b8f210ec0710e5e0
Author: Morten Welinder <terra gnome org>
Date: Thu Oct 26 15:36:26 2017 -0400
xlsx: save a view3D for contour plots.
A 3D view for a 2D plot. XL needs it.
NEWS | 1 +
plugins/excel/ChangeLog | 3 ++-
plugins/excel/xlsx-write-drawing.c | 36 ++++++++++++++++++++++++++++++------
3 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index d6063d4..c3aa360 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Morten:
* Minor CORREL improvement.
* Fix error on xlsx files with bogus Print_Area.
* xlsx import improvements for contour graphs.
+ * xlsx export improvements for contour graphs.
--------------------------------------------------------------------------
Gnumeric 1.12.35
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index ed505f6..afca323 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,7 +1,8 @@
2017-10-26 Morten Welinder <terra gnome org>
* xlsx-write-drawing.c (xlsx_write_axis): Make axis tag for
- surface charts match what XL wants. Even if it isn't obvious why.
+ contour charts match what XL wants. Even if it isn't obvious why.
+ (xlsx_write_one_chart): Save a view3D for contour charts.
2017-10-24 Morten Welinder <terra gnome org>
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 2d5d905..3512860 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -1233,14 +1233,13 @@ xlsx_write_one_plot (XLSXWriteState *state, GsfXMLOut *xml,
}
static void
-xlsx_write_plots (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *chart, int *ser_count)
+xlsx_write_plots (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *chart,
+ GSList *plots, int *ser_count)
{
- GSList *plots, *l;
- GogObjectRole const *role = gog_object_find_role_by_name (GOG_OBJECT (chart), "Plot");
+ GSList *l;
GHashTable *axis_to_plot = g_hash_table_new (NULL, NULL);
GSList *axes = NULL;
- plots = gog_object_get_children (GOG_OBJECT (chart), role);
for (l = plots; l; l = l->next) {
GogPlot *plot = l->data;
GSList *plot_axes, *al;
@@ -1255,7 +1254,6 @@ xlsx_write_plots (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *chart,
}
g_slist_free (plot_axes);
}
- g_slist_free (plots);
for (l = axes; l; l = l->next) {
GogAxis *axis = l->data;
@@ -1273,6 +1271,9 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
{
GogObject const *obj;
int ser_count = 0;
+ GogObjectRole const *role;
+ GSList *plots, *l;
+ gboolean done;
gsf_xml_out_start_element (xml, "c:chart");
@@ -1286,10 +1287,32 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
}
}
+ role = gog_object_find_role_by_name (GOG_OBJECT (chart), "Plot");
+ plots = gog_object_get_children (GOG_OBJECT (chart), role);
+
+ for (l = plots, done = FALSE; l && !done; l = l->next) {
+ GogPlot *plot = l->data;
+ const char *plot_type_name = G_OBJECT_TYPE_NAME (plot);
+ XLSXPlotType plot_type = xlsx_plottype_from_type_name (plot_type_name);
+ switch (plot_type) {
+ case XLSX_PT_GOGCONTOURPLOT:
+ case XLSX_PT_XLCONTOURPLOT:
+ // XL wants a 3D view for a 2D chart
+ gsf_xml_out_start_element (xml, "c:view3D");
+ xlsx_write_chart_float (xml, "c:rotX", 90);
+ xlsx_write_chart_float (xml, "c:rotY", 0);
+ xlsx_write_chart_float (xml, "c:rAngAx", 0);
+ xlsx_write_chart_float (xml, "c:perspective", 0);
+ gsf_xml_out_end_element (xml);
+ done = TRUE;
+ break;
+ }
+ }
+
gsf_xml_out_start_element (xml, "c:plotArea");
/* save grid style here */
- xlsx_write_plots (state, xml, chart, &ser_count);
+ xlsx_write_plots (state, xml, chart, plots, &ser_count);
obj = gog_object_get_child_by_name (GOG_OBJECT (chart), "Backplane");
if (obj) {
@@ -1302,6 +1325,7 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
}
gsf_xml_out_end_element (xml); /* </c:plotArea> */
+ g_slist_free (plots);
if ((obj = gog_object_get_child_by_name (chart, "Legend"))) {
char const *str;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]