Bug 148142 - "On tick marks" option of x-axis formatting in LibreOffice Calc is not saved
Summary: "On tick marks" option of x-axis formatting in LibreOffice Calc is not saved
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.5.2 release
Hardware: All All
: medium trivial
Assignee: Tünde Tóth
URL:
Whiteboard: target:7.6.0 target:7.5.5
Keywords:
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2022-03-22 15:28 UTC by Francois Dernoncourt
Modified: 2023-05-23 08:23 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Dernoncourt 2022-03-22 15:28:30 UTC
Description:
I created a line chart in LibreOffice Calc and updated the x-axis formatting to set it to "On tick marks" in the "positioning" tab. But when I save and re-open the document, the chart reverted to the default "Between tick marks" option.

Steps to Reproduce:
1.Create a line chart on LibreOffice Calc (it may work with other chart types)
2.Right click on the x-axis, click "format x-axis", go to "positioning" tab, check the "On tick marks" box.
3.Save the document and close it
4.Re-open the document.

Actual Results:
The chart's x-axis reverted to the default formatting option "Between tick marks"

Expected Results:
The chart's x-axis should have been saved in its "On tick marks" option


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.5.2 (x64) / LibreOffice Community
Build ID: 499f9727c189e6ef3471021d6132d4c694f357e5
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: fr-FR (en_GB); UI: en-GB
Calc: threaded
Comment 1 Julien Nabet 2022-03-22 20:43:57 UTC
On pc Debian x86-64 with master sources updated today, I could almost reproduce this.
I mean, at the beginning the option by default is on "On tick marks" by default.
Then if I set "Between tick marks", save it, reopen and try to put back "On tick marks", it takes it into account but when saving again and reopening, it forgot the change and stays on "Between tick marks".
Comment 2 Julien Nabet 2022-03-27 10:26:19 UTC
It works with this patch:
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 8bc776e5e421..616300000ea4 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2341,7 +2341,7 @@ void SchXMLExportHelper_Impl::exportAxis(
     const Reference< chart2::XAxis >& rChart2Axis,
     const OUString& rCategoriesRange,
     bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid,
-    bool bExportContent, std::u16string_view sChartType )
+    bool bExportContent, std::u16string_view /* sChartType */)
 {
     std::vector< XMLPropertyState > aPropertyStates;
     std::unique_ptr<SvXMLElementExport> pAxis;
@@ -2356,13 +2356,7 @@ void SchXMLExportHelper_Impl::exportAxis(
         {
             chart2::ScaleData aScaleData(rChart2Axis->getScaleData());
             bool bShiftedCatPos = aScaleData.ShiftedCategoryPosition;
-            if (sChartType == u"com.sun.star.chart.BarDiagram" || sChartType == u"com.sun.star.chart.StockDiagram")
-            {
-                if (!bShiftedCatPos)
-                    rAxisProps->setPropertyValue("MajorOrigin", uno::makeAny(0.0));
-            }
-            else if (bShiftedCatPos)
-                rAxisProps->setPropertyValue("MajorOrigin", uno::makeAny(0.5));
+            rAxisProps->setPropertyValue("MajorOrigin", uno::makeAny(bShiftedCatPos?0.5:0.0));
         }
 
         lcl_exportNumberFormat( "NumberFormat", rAxisProps, mrExport );


Tünde/László: any thoughts here about what was the use of testing sChartType ?
Comment 3 Commit Notification 2023-05-19 11:09:48 UTC
Tünde Tóth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/deb2512e5ea16ad8fa9f975569fbc5363cebf8dd

tdf#148142 chart: fix export of modified On/Between tick marks

It will be available in 7.6.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 4 Commit Notification 2023-05-22 11:02:15 UTC
Tünde Tóth committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/9d7d35718f32fd757f6ce994e6aab0c6f3494b3c

tdf#148142 chart: fix export of modified On/Between tick marks

It will be available in 7.5.5.

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 5 NISZ LibreOffice Team 2023-05-23 08:23:46 UTC
Verified in:
Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: f4c24da1e7f11664e0d2f688d2531f068e4a3bc0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: CL threaded