Bug 138556 - Stock Chart easily corrupts data on saving - 'Insert Series' creates series with incorrect number of components
Summary: Stock Chart easily corrupts data on saving - 'Insert Series' creates series w...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Aritz Erkiaga
Whiteboard: target:7.2.0
Keywords: dataLoss
Depends on:
Reported: 2020-11-29 21:18 UTC by Aritz Erkiaga
Modified: 2024-05-02 11:55 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

test_stock_chart13_insert_series.log (2.25 KB, text/x-log)
2021-05-24 14:32 UTC, Kevin Suo

Note You need to log in before you can comment on or make changes to this bug.
Description Aritz Erkiaga 2020-11-29 21:18:07 UTC
Creating a Stock Chart with simple data, saving and reopening is sufficient to corrupt the data. The styles applied to the chart elements were also altered.

Steps to Reproduce:
1. Open Writer or Impress (didn't test on Calc)
2. Click 'Insert' -> 'Chart...'
3. Select the chart, right click and open 'Chart Type...' dialog.
4. Select 'Stock Chart 1' as type.
5. Now open the 'Data Table' dialog.
6. There's a single data series with three components: 'Low Values', 'High Values' and 'Close Values'. Click on the label for the data series and then on 'Delete Series'.
7. Click 'Insert Series' twice to insert two data series. These have the same components, plus a fourth 'Open Values'.
8. Optionally, click on 'Delete Row' three times to simplify the next step.
9. Enter data on all cells except the 'Open Values'. Something like 1, 3, 2; 4, 6, 5 will do.
10. Close the dialog, deselect the chart, save the file and close LibreOffice.
11. Reopen the same file.

Actual Results:
The chart seems clearly broken, with a different style (some data series are now black), names of data series removed, data corrupted and a new anonymous data series. Opening the data table for this chart reveals that those 'Open Values' are no longer there; while the one for the first data series has apparently simply vanished, the second one has pushed into the 'Low Values' of the data series, shifting all cells to the right, so the last cell overflows into a new data series.

Expected Results:
The chart should contain the same data and have the same styles applied as when it was originally saved.

Reproducible: Always

User Profile Reset: No

OpenGL enabled: Yes

Additional Info:
In a more complex example, other effects could be seen. Some series were renamed while others weren't, line width was dropped, even some data series were reordered.

Build ID: 00(Build:1)
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.0.3-0ubuntu0.20.04.1
Calc: threaded
Comment 1 Aritz Erkiaga 2020-11-30 08:36:33 UTC
Note that this bug report involves specific data in a chart being corrupted. Bug 69698 refers to chart styles. However, this bug seems to also affect styles to some degree, so both issues could be at least related.
Comment 2 Aritz Erkiaga 2020-12-17 15:30:52 UTC
Reproduced in LibreOffice
Comment 3 Aritz Erkiaga 2021-03-22 13:52:23 UTC
Reproduced in LibreOffice
Comment 4 Aritz Erkiaga 2021-03-22 14:18:28 UTC
Tested and confirmed on LibreOffice 3.3, setting earliest version to "Inherited From OOo"
Comment 5 Aritz Erkiaga 2021-03-22 14:43:38 UTC
Changon chart type to 'Stock Chart 2' restores chart data, as does creating the chart as that type in the first place. Also, using the data series without 'Open Values' already present after changing chart type to 'Stock Chart 1' and not creating any new data series avoids this issue.
So, the problem seems to be simply that adding new data series to a 'Stock Chart 1' generates data series with 4 components, 'Open Values', while for all other purposes the chart is considered not to have this fourth component. Chart data bleeds into other series and style data, corrupting the chart.
Comment 6 Aritz Erkiaga 2021-03-22 14:50:59 UTC
Accordin to the manual, chart type 'Stock Chart 1' should not have an 'Open Values' component at all.
Comment 7 Aritz Erkiaga 2021-03-23 22:19:29 UTC
Assigned this to myself.
Comment 8 Commit Notification 2021-05-21 07:56:06 UTC
Aritz Erkiaga committed a patch related to this issue.
It has been pushed to "master":


tdf#138556 Don’t add Open Values to stock chart types 1 and 3

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

Affected users are encouraged to test the fix and report feedback.
Comment 9 Kevin Suo 2021-05-24 14:32:22 UTC
Created attachment 172297 [details]

The UITest on my system has failed, see attached log. Is there something wrong with the test code, or something else?
Comment 10 Aritz Erkiaga 2021-05-25 21:51:18 UTC
This bug is not present in the last few daily builds, so I'm finally closing it. Regarding the UITest failure you report, I haven't been able to replicate it myself, sorry... I've seen that same error in another testcase in one machine, but it didn't seem to occur in any further checks. I can't pinpoint any particular reason this test code should fail, but I wouldn't be surprised if there was a bug in it, after all I wrote it :')

Anyway, could you test it again on your system? I'll ask about the issue in any case, but if you do get this error consistently, then... well, I'll feel a great deal more worried.
Comment 11 Kevin Suo 2021-05-26 01:30:09 UTC
(In reply to Aritz Erkiaga from comment #10)
I now know why the test fails:

ERROR: test_stock_chart13_insert_series (tdf138556.tdf138556)
Traceback (most recent call last):
  File "...sw/qa/uitest/chart/tdf138556.py", line 45, in test_stock_chart13_insert_series
    xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" }))
tdf138556.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call ...binaryurp/source/bridge.cxx:613

That means that before executing line 45 (i.e, inserting series), the application must have already been disposed (mostly crashed!). And a manual test confirms that on my system when click the insert series icon it crashes, which is exactly bug 142467.
Comment 12 Aritz Erkiaga 2021-05-26 09:05:26 UTC
Interesting... So the crash does not depend on this bug, and is not fixed by the patch? But it also wasn't introduced by it?
Comment 13 Kevin Suo 2021-05-26 13:24:21 UTC
(In reply to Aritz Erkiaga from comment #12)
Yes you are correct. Your patch does not fix the crash, and the crash seems have been there a long time ago. Caolán says he is debugging that crash.
Comment 14 Kevin Suo 2021-05-26 13:26:04 UTC
But it was at the time when I am running your UITest script when this crash arises - that been said, you discovered the crash :-)
Comment 15 gullajaina 2024-05-02 11:55:19 UTC
Stock charts can indeed be finicky when it comes to saving data reliably. It's crucial to ensure accuracy, especially when making investment decisions. Speaking of investments, have you considered diversifying your portfolio to include emerging opportunities like investing in AI-driven technologies? If you're curious about how to invest in ChatGPT stock, check out this https://meyka.com/blog/how-to-invest-in-chatgpt-stock useful guide. It provides valuable insights into navigating this exciting market.