Bug 96662 - FILESAVE: crossBetween attribute set incorrectly when chart saved as OOXML
Summary: FILESAVE: crossBetween attribute set incorrectly when chart saved as OOXML
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
5.1.0.0.alpha0+ Master
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0 target:5.2.3
Keywords: bibisected, bisected, regression
: 99629 (view as bug list)
Depends on:
Blocks: OOXML-Chart
  Show dependency treegraph
 
Reported: 2015-12-22 02:36 UTC by Luke
Modified: 2016-09-21 09:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Save as XLSX and Open in Excel (14.58 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-12-22 02:36 UTC, Luke
Details
Native Excel file. Roundtrip this to reproduce. (10.25 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-12-22 02:40 UTC, Luke
Details
Comparision Original with Roundtripped version (88.91 KB, image/png)
2015-12-22 02:41 UTC, Luke
Details
Comparision Original with Roundtripped version (92.84 KB, image/png)
2015-12-22 03:09 UTC, Luke
Details
printscreen from excel2010 (39.75 KB, image/png)
2015-12-29 18:39 UTC, raal
Details
More Examples: save as XLSX and open in Excel (29.38 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-12-31 18:41 UTC, Luke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke 2015-12-22 02:36:25 UTC
Created attachment 121488 [details]
Save as XLSX and Open in Excel

Steps to reproduce:
1. Create a chart in Calc
2. Make any change to the chart area, such as adding a background color
3. Save as XLSX
4. Open in Excel

Note the chart area goes outside the chart frame, so the first and last bars are rendered outside of the chart's frame. If the file is saved as XLS, the chart is properly exported. If the file is saved with LibreOffice Calc 4.3 or earlier, the chart is properly exported. If no changes are made to the chart's area, it's properly exported. Round-tripped native Excel files are also affected by this bug.
Comment 1 Luke 2015-12-22 02:40:09 UTC
Created attachment 121489 [details]
Native Excel file. Roundtrip this to reproduce.
Comment 2 Luke 2015-12-22 02:41:00 UTC
Created attachment 121490 [details]
Comparision Original with Roundtripped version
Comment 3 Luke 2015-12-22 03:09:17 UTC
Created attachment 121491 [details]
Comparision Original with Roundtripped version

Note the Axis Position is changed from "Between tick marks" to "On tick marks". Togging this setting back, fixes the issue.

The OOXML responsible for this is 

<c:crossBetween val="between"/>
vs
<c:crossBetween val="midCat"/>

Manually changing this single element in the roundtripped file's XML fixes the issue.
Comment 4 raal 2015-12-29 18:37:24 UTC
(In reply to Luke from comment #0)
> Created attachment 121488 [details]
> Save as XLSX and Open in Excel

I cannot confirm with your file in Version: 5.2.0.0.alpha0+
Build ID: 4c4f096a81e1643646f72cab17fb94610a346961
CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2015-12-28_11:02:13
and excel 2010

with attachment 121489 [details] the bars are moved, but still visible in chart ("Between tick marks"). Setting as new. Problem is probably better visible in excel 2013.
Comment 5 raal 2015-12-29 18:39:29 UTC
Created attachment 121617 [details]
printscreen from excel2010
Comment 6 Joel Madero 2015-12-30 16:17:38 UTC
What about versions 4.4, 5.0, and 5.1? We know it works in 4.3, when did you first notice that there was a problem?
Comment 7 Luke 2015-12-31 12:04:04 UTC
Using my older builds I was able to narrow this regression down to 9/9-9/16.
Build ID: 86aebe9e5b084a737ce18e4620e8d8f0998eb5a1 -> GOOD
Build ID: afce2eee1d163d942385c7b33db4901b3c71135d -> BAD

After reviewing them, the only suspicious commit that I see is:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=694419d813c14f6135aa4463d77f72c3a24a5cc5

author	Caolán McNamara <caolanm@redhat.com>	2015-09-10 02:16:06 (GMT)
Related: tdf#93676 in msword chart appears with axis positioned between ticks

Caolán,
Could you please take a look at this regression?
Comment 8 Luke 2015-12-31 18:41:25 UTC
Created attachment 121668 [details]
More Examples: save as XLSX and open in Excel

In this example, I show that making any change to the chart will trigger the bug. Here I made 5 identical charts, then made changes like moving the legend, or changing a bar color. 

I confirmed reverting commit 694419d813c14f6135aa4463d77f72c3a24a5cc5, resolved this issue.
Comment 9 Luke 2016-01-06 03:56:55 UTC
Caolán,
It appears your fix for Bug 93676 is over aggressive. We need to limit to LibreOffice generated line charts. Only they use defaults that map to Excel’s “on tick mark”. Even Excel's own line charts default to “between tick marks”. Both LibreOffice and Excel Bar Charts default to “between tick marks”. 

So, we should only force “on tick mark” for native generated line chart. For native bar charts we should always use “between tick marks”. Ideally, for OOXML charts that already have the value set, we should pass this value through.
Comment 10 Andrew Cunningham 2016-08-14 02:54:36 UTC
When I tried to use .docx format to share some charts with coworkers, they reported that the inner and outer most charts were cut off. I used LibreOffice 5.1.5. I assume it's the same issue as reported here with .xlsx.

@Caolan 
Can you please look into this regression?
Comment 11 Björn Michaelsen 2016-08-24 22:00:34 UTC
Assuming bisected to imply bibisected, thus adding the latter. This is to make queries for "bibisected" not miss out bisected bugs.
Comment 12 Markus Mohrhard 2016-09-17 11:23:43 UTC
*** Bug 99629 has been marked as a duplicate of this bug. ***
Comment 13 Commit Notification 2016-09-20 13:32:15 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d09bfe6bf10fe16e087c7f30268b72f36c33302e

tdf#96662, only use the crossBetween="midCat" for line and scatter chart

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Luke 2016-09-21 08:10:13 UTC
Verified FIXED with Version: 5.3.0.0.alpha0+ (x64)
Build ID: a8a8ff59c5749bbe1f2f58ea8fd42d66e6ae2a81

Thanks Markus!
Comment 15 Commit Notification 2016-09-21 09:31:22 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8a2781dde395fc45b943daf5e238ba98276bd405&h=libreoffice-5-2

tdf#96662, only use the crossBetween="midCat" for line and scatter chart

It will be available in 5.2.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.