GNOME Bugzilla – Bug 788447
axes labels are exported as <chart:domain> for class:surface
Last modified: 2017-10-14 06:22:10 UTC
Make a surface chart, left button, from the data e.g. in A1:F6 One Two Three Four Five Jan 0 -1 -4 -5 -9 Feb 12 8 -4 -8 -24 Mar 20 15 0 -5 -25 Apr 42 35 14 7 -21 May 90 80 50 40 0 The reference for the labels for the x-axis and for the y-axis are in a <chart:domain> element. But in the specification [1], section 19.15.1, page 338, you find the text "In both cases two <chart:domain> elements may be used to specify the y-values and x-values to be used (19.593.5). In this case the jth value of the table:cell-range-address attribute of the first <chart:domain> element specifies the y-values used for the values in the jth row of the cell range given by the chart:values-cell-range-address attribute of the <chart:series> element and the ith value of the table:cell-range-address attribute of the second <chart:domain> element specifies the x-values used for the values in the ith column." So it is expected, that these elements refer to numbers. But in this case there are strings. I expect, that the labels are in the <chart:categories> element of the <chart:axis> element with attribute chart:dimension="x" and chart:dimension="y" respectively. That would correspond to labeling category-axis in other chart types. [1]http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.odt
It would be helpful with a sample file in .gnumeric format to ensure that we are looking at the same thing.
Created attachment 360800 [details] file with the data from the bug description Newer version is not available for Windows.
It is not clear to me that using <chart:domain> is wrong. The ODF description generically uses the term "values" which also covers string values. The description of the first type of surface graphic does not mention the <chart:categories> element, that element is only referred to in the description of the second type of surface plot.
Created attachment 360801 [details] sample gnumeric file
Look at the text "If chart:three-dimensional="true" a surface chart is displayed in a right-handed three-dimensional Cartesian coordinate system with horizontal x-axis (from left to right), a perspective y-axis running from the front to the right rear and a vertical z-axis (prior to any 3D scene transformation)." in section 19.15.1 and the text "The table:cell-range-address attribute of the first <chart:domain> element specifies the y-coordinate values and the table:cell-range-address attribute of the second <chart:domain> element specifies the x-coordinate values for surface charts" from section 19.593.5. For me "x-coordinate value" in a "three-dimensional Cartesian coordinate system" is a number and not a string. I have described the problem here so that you can discuss it before it is on the ODF TC agenda.
Regina, let us look at the whole picture: <chart:chart svg:width="406.00000000000006pt" svg:height="230pt" xlink:type="simple" xlink:href=".." chart:class="chart:surface" chart:style-name="plotstyle"> <chart:plot-area chart:style-name="GOG--1" gnm:is-position-manual="false"> <chart:axis chart:dimension="z" gnm:id="1" chart:name="Z-Axis-1" chart:style-name="GOG-3"> <chart:categories table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:axis> <chart:axis chart:dimension="y" gnm:id="1" chart:name="Y-Axis-1" chart:style-name="GOG-2"> <chart:categories table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:axis> <chart:axis chart:dimension="x" gnm:id="1" chart:name="X-Axis-1" chart:style-name="GOG-1"> <chart:categories table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:axis> <chart:series chart:values-cell-range-address="$'Sheet1'.$B$2:.$F$6" chart:style-name="GOG-4"> <chart:domain table:cell-range-address="$'Sheet1'.$A$2:.$A$6"/> <chart:domain table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:series> </chart:plot-area> </chart:chart> <chart:categories So the categories shown on the axes are determined by the <chart:categories> elements if the <chart:axis> element expects that, which I believe is true for the x and y axes here. The <chart:series> element contains two <chart:domain> elements which describe the values of the x and y axes if appropriate. You seem to argue that the representation of the chart should depend on whether the table:cell-range-address="$'Sheet1'.$A$2:.$A$6" and table:cell-range-address="$'Sheet1'.$B$1:.$F$1" contain numbers or strings. I would argue that it is preferable if the representation of the chart would be independent of the content of those regions, since in that way the values that happen to exist in the sheet influence the results but not the representation of the formulas and objects. Perhaps it would be useful if you could provide which representation you would prefer.
On closer lokk I see that the table:cell-range-address of the x axis should be "$'Sheet1'.$A$2:.$A$6". That is obviously a bug.
Andreas, I would prefer <chart:chart svg:width="406.00000000000006pt" svg:height="230pt" xlink:type="simple" xlink:href=".." chart:class="chart:surface" chart:style-name="plotstyle"> <chart:plot-area chart:style-name="GOG--1" gnm:is-position-manual="false"> <chart:axis chart:dimension="z" gnm:id="1" chart:name="Z-Axis-1" chart:style-name="GOG-3"> </chart:axis> <chart:axis chart:dimension="y" gnm:id="1" chart:name="Y-Axis-1" chart:style-name="GOG-2"> <chart:categories table:cell-range-address="$'Sheet1'.$A$2:.$A$6"/> </chart:axis> <chart:axis chart:dimension="x" gnm:id="1" chart:name="X-Axis-1" chart:style-name="GOG-1"> <chart:categories table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:axis> <chart:series chart:values-cell-range-address="$'Sheet1'.$B$2:.$F$6" chart:style-name="GOG-4"> </chart:series> </chart:plot-area> </chart:chart> When there exists no <chart:domain> element, then the first paragraph of the spec applies. That is a description for a surface having category-x-axis and category-y-axis. The case where <chart:domain> element exists is the case having value-axes in x- and y-direction. The distinction is similar to the distinction between chart:line with a category-x-axis and chart:scatter with a value-x-axis. In case of category x-axis the coordinates are 1.0, 2.0, ... In case of value x-axis the x-coordinates are taken from a <chart:domain> element. For chart:surface it is the same, only one dimension more. In case chart:line it is said explicitly, that the <chart:categories> child element of the <chart:axis> can be used for axis labels. In case chart:surface a statement about axis labels is missing. I prefer to use a similar solution as in chart:line to be consistent. Therefore I put the axis labels into the <chart:categories> elements. A <chart:categories> element makes no sense for the z-axis, because it is a value-axis and a such has not 'categories'. Therefore I omit it for z.
Regina, I don't think what you are suggesting works reasonably. Suppose we have the following data: One Two Three Four Five =if(mod(day(today()),2),"Jan",1) 0 -1 -4 -5 -9 =if(mod(day(today()),2),"Feb",2) 12 8 -4 -8 -24 =if(mod(day(today()),2),"Mar",3) 20 15 0 -5 -25 =if(mod(day(today()),2),"April",15) 42 35 14 7 -21 =if(mod(day(today()),2),"May",16) 90 80 50 40 0 If I understand you correctly, then you suggest that on an even day we save the chart using a chart:domain and on an odd day we do not use chart:domain. It does not seem sensible to change the way we save the table just because the date is different.
Created attachment 361471 [details] ODF file with the srcondset of data
The export now looks like: <office:chart> <chart:chart svg:width="273pt" svg:height="156pt" xlink:type="simple" xlink:href=".." chart:class="chart:surface" chart:style-name="plotstyle"> <chart:plot-area chart:style-name="GOG--3" gnm:is-position-manual="false"> <chart:axis chart:dimension="z" gnm:id="1" chart:name="Z-Axis-1" chart:style-name="GOG-8"/> <chart:axis chart:dimension="y" gnm:id="1" chart:name="Y-Axis-1" chart:style-name="GOG-7"> <chart:categories table:cell-range-address="$'Sheet1'.$A$2:.$A$6"/> </chart:axis> <chart:axis chart:dimension="x" gnm:id="1" chart:name="X-Axis-1" chart:style-name="GOG-6"> <chart:categories table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:axis> <chart:series chart:values-cell-range-address="$'Sheet1'.$B$2:.$F$6" chart:style-name="GOG-9"> <chart:domain table:cell-range-address="$'Sheet1'.$A$2:.$A$6"/> <chart:domain table:cell-range-address="$'Sheet1'.$B$1:.$F$1"/> </chart:series> </chart:plot-area> </chart:chart> </office:chart>
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.