Bug 123218

Summary: FILESAVE OOXML Doughnut chart circles exported in a different order
Product: LibreOffice Reporter: NISZ LibreOffice Team <libreoffice>
Component: WriterAssignee: Tünde Tóth <tundeth>
Status: VERIFIED FIXED    
Severity: normal CC: kelemeng, nemeth, xiscofauli
Priority: medium Keywords: filter:docx
Version: 4.4 all versions   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=108067
https://bugs.documentfoundation.org/show_bug.cgi?id=108059
Whiteboard: target:7.1.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 75057    
Attachments: Screenshot of the problem in Writer with the expected result (above) and the wrong result after filesave and reload (below).
Example file from Word with the wrong circle order.
The original odt file from Writer with the right circle order. (The docx file should look like this).
mso example docx file with lo doughnut chart default values datatable
comparing mso and lo behavior with lo doughnut chart default datatable values
Naive Excel correctly Roundtrips
Native Calc shows XLS and XLSX affected

Description NISZ LibreOffice Team 2019-02-07 08:30:20 UTC
Description:
If creating a doughnut chart in LibreOffice, after save and reload, the order of its circles become reversed.

Steps to Reproduce:
    1. click on insert toolbar, select chart
    2. right click on the chart, select chart type
    3. select pie, select donut
    4. click on the outer circle, right click, select insert data labels
    5. save and reload

Actual Results:
Outer circle(s) become inner circle(s).

Expected Results:
Do not change the order of circles.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 NISZ LibreOffice Team 2019-02-07 08:31:10 UTC
Created attachment 148969 [details]
Screenshot of the problem in Writer with the expected result (above) and the wrong result after filesave and reload (below).
Comment 2 NISZ LibreOffice Team 2019-02-07 08:31:34 UTC
Created attachment 148970 [details]
Example file from Word with the wrong circle order.
Comment 3 NISZ LibreOffice Team 2019-02-07 08:31:52 UTC
Created attachment 148971 [details]
The original odt file from Writer with the right circle order. (The docx file should look like this).
Comment 4 NISZ LibreOffice Team 2019-02-07 13:42:41 UTC
Created attachment 148979 [details]
mso example docx file with lo doughnut chart default values datatable
Comment 5 NISZ LibreOffice Team 2019-02-07 13:43:10 UTC
Created attachment 148980 [details]
comparing mso and lo behavior with lo doughnut chart default datatable values
Comment 6 Luke 2019-02-09 20:54:27 UTC
Created attachment 149061 [details]
Naive Excel correctly Roundtrips

This is tricky because LO's default order is outer to inner, while MSO's order is inner to outer order. We already correctly round trip MSO docs preserving the order. We only want to swap the order when converting ODF to OOXML

The order is preserved even if you take an MSO doughnut, imported it to ODF, and then exported it to back to OOXML. The only case that is broken is when you start as ODF. Is there some compatibility flag that needs to be set or checked?  Both XLS and XLSX are affected.
Comment 7 Luke 2019-02-09 20:55:15 UTC
Created attachment 149062 [details]
Native Calc shows XLS and XLSX affected
Comment 8 Adam Kovacs 2019-02-12 11:02:13 UTC
Some results:

If you reverse this loop...
(like this:
for( sal_Int32 nSeriesIdx= rSeriesSeq.getLength()-1; nSeriesIdx<=0; --nSeriesIdx ))
...then the order of circles will be reversed after every filesave (and reload).
https://opengrok.libreoffice.org/xref/core/oox/source/export/chartexport.cxx?r=82b91027#1941

There is a member function about the view in piechart.cxx:
https://opengrok.libreoffice.org/xref/core/chart2/source/view/charttypes/PieChart.cxx?r=033ebc5a#390
which is working this way:
https://opengrok.libreoffice.org/xref/core/chart2/source/view/inc/VSeriesPlotter.hxx?r=40144617#134
...it can be a related stuff.
Comment 9 Adam Kovacs 2019-02-12 11:52:21 UTC
If this bug is fixed, it probably fix this also:
https://bugs.documentfoundation.org/show_bug.cgi?id=108067
Comment 10 Commit Notification 2020-08-24 10:08:30 UTC
Tünde Tóth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/22cd7d8b679d238559820d3c4cd5ff0b9153ffce

tdf#123218 tdf#108067 config key ReverseXAxisOrientationDoughnutChart

It will be available in 7.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 11 NISZ LibreOffice Team 2020-08-25 10:10:46 UTC
No backport needed since the commit adds a config key.
Comment 12 NISZ LibreOffice Team 2020-09-14 09:48:14 UTC
Verified in:

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 34a09c9c61bff30e8c4d16132bb47b2b1b16e422
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded