Bug 166428 - Stock Chart is not correctly saved and corrupts the spreadsheet file
Summary: Stock Chart is not correctly saved and corrupts the spreadsheet file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: x86-64 (AMD64) Windows (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0 target:25.8.0.0.beta2 t...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2025-05-02 08:07 UTC by MS
Modified: 2025-06-16 09:47 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
example data for a stock chart (13.23 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-05-02 17:06 UTC, MS
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MS 2025-05-02 08:07:36 UTC
Description:
When creating a stock chart which is not Type 1, everything looks as expected. But when the file is saved, closed and opened again, the specific stock data is replaced by several unspecific data rows (the number depends on how many columns have your data table, used as data source). Of course also the chart is empty, because the data is now nonsense. When saving again, the data rows in the chart multiply again and again with each following save. After a while the document can still be opened, but saving takes longer and longer and the file size increases dramatically. 

Steps to Reproduce:
1. create a new spreadsheet document
2. create a data table with 3 rows and 3 columns, enter any numbers in this matrix (e.g. 1 to 9 distributed over the cells)
3. select the data matrix and create a chart, type "stock chart", use NOT the Type 1, but e.g. "candle stick chart" (Type 2)
4. save the file
5. close the file
6. open the saved file

Actual Results:
1. before saving, the diagram is shown and has one data row with "low", "high" and "close" values attached
2. after closing and opening again, you have 4 data rows, where the first is empty and all others have the table columns attached as Y-Data
3. if saving, closing and opening again, the number of chart data rows multiplies with the number of table columns, and this happens each time you save

Expected Results:
after opening the saved file, the result should be the same as before closing 


Reproducible: Always


User Profile Reset: Yes

Additional Info:
you can compare the content.xml from the document with a diff-viewer to see, how the number of data rows increases with each save operation

Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL threaded
Comment 1 m_a_riosv 2025-05-02 14:42:39 UTC
What file format do you use to save?

Please attach a sample file with the raw data, without the chart, to test it.
Comment 2 MS 2025-05-02 17:06:40 UTC
Created attachment 200633 [details]
example data for a stock chart

The saved file is ods format. It contains the sample data for stock chart from libreoffice-help, without having the chart inside.
Comment 3 m_a_riosv 2025-05-02 23:02:48 UTC
Seems the issue is at saving, open a file saved with the chart right in Ver 24.8.7 o previous open the chart fine with 25.2 or posterior.
But saving with 25.2 or posterior, shows the issue with 24.8.7 or previous.

Reproducible
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
+
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 923da8a3855afae1f3f3a5f50d1fec08bbc02438
CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-GB
Calc: CL threaded


Latest version that works on the ones I have installed.
Version: 24.8.7.1 (X86_64) / LibreOffice Community
Build ID: 67172c63871c755bc0e5f9fc0c892575790cdcf6
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Comment 4 Jeremy Norvell 2025-06-10 02:55:06 UTC
Adding cc: to <rb.henschel@t-online.de>
 
Hello. I have bibisected the described behavior, it first appears in version 25.2 and the bibisect-win64-25.2 bundle was used to bisect.
  57228f39961f1bc6cc6ced4e91c9f1d040e4d5dc is the first bad commit
commit 57228f39961f1bc6cc6ced4e91c9f1d040e4d5dc
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Fri Nov 29 01:13:32 2024 -0800

    source 7cec59402d09077749cc6bbe96cbf19652d2d3d9

    source 7cec59402d09077749cc6bbe96cbf19652d2d3d9

 instdir/program/setup.ini   |   2 +-
 instdir/program/version.ini |   2 +-
 instdir/program/xolo.dll    | Bin 5224960 -> 5224960 bytes
 3 files changed, 2 insertions(+), 2 deletions(-)
Comment 5 Xisco Faulí 2025-06-10 06:53:24 UTC
Hi Regina,
Should the patch be reverted for now ?
Comment 6 Regina Henschel 2025-06-10 11:34:31 UTC
(In reply to Xisco Faulí from comment #5)
> Hi Regina,
> Should the patch be reverted for now ?

The attribute table:cell-range-address does not exist in ODF 1.4. After reverting the patch, this attribute would be written, producing invalid markup.
Comment 7 Regina Henschel 2025-06-10 14:07:54 UTC
The columns of a stock chart have a strict arrangement.

Variant 1: Low High Close
Variant 2: Open Low High Close
Variant 3: Volume Low High Close
Variant 4: Volume Open Low High Close

These arrangements are described in
https://wiki.documentfoundation.org/Documentation/DevGuide/Charts#Stock_Charts

For these arrangements, I see no problem in save and reload.

The help has the description in
https://help.libreoffice.org/26.2/en-US/text/schart/01/type_stock.html

The help mentions for Variant 1 as second possible arrangement Low High.
For this arrangement, there is indeed a save - reload problem.

I think, this is an error in stock charts. Only that it becomes visible with my patch. The solution would be to fix the error in the stock chart.

Till it is fixed, users can use the workaround to save to "ODF 1.3 extended" instead of "ODF 1.4 extended" in case they need the variant 1 with "Low High", or they can include an empty Close column in their data.
Comment 8 Regina Henschel 2025-06-11 18:44:06 UTC
A proposed patch is in https://gerrit.libreoffice.org/c/core/+/186386.
Comment 9 Commit Notification 2025-06-12 09:06:57 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

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

tdf#166428 accept stock charts with only low and high series

It will be available in 26.2.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 10 Commit Notification 2025-06-16 09:47:48 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

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

tdf#166428 accept stock charts with only low and high series

It will be available in 25.8.0.0.beta2.

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 Commit Notification 2025-06-16 09:47:52 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/6e6e63ec4c98dfba52f3675e7345223d8c2647fe

tdf#166428 accept stock charts with only low and high series

It will be available in 25.2.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.