Created attachment 138108 [details] Example file made with Excel 2013 FILESAVE XLSX stacked bar chart legend reversed after open the file in Calc If we create stacked bar chart with Microsoft Excel, and we add legend to the chart and open the file with LibreOffice Calc, the order of legend is reversed. Steps to reproduce: 1. Create a new spreadsheet in Microsoft Excel. 2. Add values to a few cells as in the attached file (There should be at least two data series). 3. Select the cell range that contains the data. 4. Create a simple Stacked Bar chart in Microsoft Excel. 5. Add the legend to the chart. 5. Open the file in LibreOffice Calc and compare the legends. Actual results: Stacked Bar chart legend reversed after open the file. Expected results: Stacked Bar chart legend should not be reversed after opening the file.
Hi Gabor, Reproduced with LO 6.0.0.0.beta1 Build ID: 97471ab4eb4db4c487195658631696bb3238656c Threads CPU : 2; OS : Windows 6.1; UI Render : par défaut; Locale : en-US (fr_FR); Calc: CL
I'm not able to reproduce it with LibreOffice 5.4. Could you please attach screenshot with comparison?
Possibly related to bug 53301?
Created attachment 144857 [details] The example file saved by Calc 6.1 So Excel writes this property to the Chart1.xml: <c:order val="0"/> Calc seems to ignore this, and writes this: <c:order val="1"/> Which in turn is ignored by Excel and shows the legend in the original order.
Created attachment 145046 [details] LibreOffice vs MS Office legend comparison The root cause of displaying legend in reversed, is how to LibreOffice/MS Office is handling data series for Legend. LibreOffice is taking data from right to left, but MS Office from left to right. What we could fix is export of the chart. After export data series is displayed in wrong order. The root cause of issue is line which is saved wrongly by LibreOffice: <c:orientation val="maxMin"/> In Office it is: <c:orientation val="minMax"/> in chart1.xml file
After deep anaylysis it seems that this is generic issue with LibreOffice Charts, not related to XLSX import. Steps to reproduce: 1. Open LibreOffice 2. Create some data with axis labels 3. Select data range 4. Click "Insert -> Chart" 5. Switch for different chart types (eg. Column, Bar...), and variants (eg. Normal, Stacked, Percent Stacked) , and observe the legend order. Actual results: Stacked Bar, Percent Stacked Bar, Stacked Column, Percent Stacked Column, Stacked Area, Percent Stacked Area, Points and Lines chart legends reversed. Expected results: Stacked Bar, Percent Stacked Bar, Stacked Column, Percent Stacked Column, Stacked Area, Percent Stacked Area, Points and Lines chart legends NOT reversed.
This is the code pointer: https://opengrok.libreoffice.org/xref/core/chart2/source/view/charttypes/VSeriesPlotter.cxx#2223 And I think we should respect the direction of axis: But unfortunately we did not know the axis on this level. https://opengrok.libreoffice.org/xref/core/chart2/source/view/charttypes/VSeriesPlotter.cxx#2225 Or the chart types, for example the legends should reversed in case of BAR charts. But unfortunately, on this level there is no difference between CHART2_SERVICE_NAME_CHARTTYPE_BAR and CHART2_SERVICE_NAME_CHARTTYPE_COLUMN chart types. But if we know the axis on this level we could use the isSwapXAndY() for handling this.
So I think first we should remove this: https://opengrok.libreoffice.org/xref/core/chart2/source/view/charttypes/VSeriesPlotter.cxx#2223 The second step is to handle the charttypes (BAR/COLUMN) legend direction. (that would be more options). And the third would be a hard codeing for respect the axis directions. What do you think about this Bartosz?
Created attachment 147322 [details] Video from review https://gerrit.libreoffice.org/#/c/64632/ Unfrotunately I cannot find much difference with the patch. See attached video.
Created attachment 147323 [details] Video from review: https://gerrit.libreoffice.org/#/c/64632/ Thank you for the review and the video. But I am a little confused. I tested the problem with the patch and it worked for me even if I did the same way just like you in the video.
Created attachment 147325 [details] Screenshot of the original file in LO61 LO_Master and MSO Screenshot of the original file in LO61 LO_Master (with the patch) and MSO. May I ask that how did you exactly the file in the video or can you send me the file?
Created attachment 147341 [details] Expected results in case of BAR/COLUMN chart Expected results in case of BAR/COLUMN chart legend orientation: Screenshot from MSExcel 2016
Balazs Varga committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/40144617ce05d7eff86eeb8a412c6991fe0b819e%5E%21 tdf#114163 Chart: fix order of legend names It will be available in 6.3.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.
Balazs Varga committed a patch related to this issue. It has been pushed to "libreoffice-6-2": https://git.libreoffice.org/core/+/ee2434656f24ccb31246b1347d46b72710faf076%5E%21 tdf#114163 Chart: fix order of legend names It will be available in 6.2.0.1. 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.