Bug 151753

Summary: Cannot change data range of Chart based on non-continues range of Writer table
Product: LibreOffice Reporter: Regina Henschel <rb.henschel>
Component: ChartAssignee: Caolán McNamara <caolan.mcnamara>
Status: VERIFIED FIXED    
Severity: normal CC: caolan.mcnamara, miguelangelrv, raal, stephane.guillou
Priority: medium Keywords: bibisected, bisected, regression
Version: 4.4.7.2 release   
Hardware: x86-64 (AMD64)   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=152557
Whiteboard: target:7.6.0 target:7.5.0.0.beta2 target:7.4.4
Crash report or crash signature: Regression By: Caolán McNamara
Bug Depends on:    
Bug Blocks: 90486    
Attachments: Chart with not changeable data range.

Description Regina Henschel 2022-10-25 13:38:46 UTC
Created attachment 183259 [details]
Chart with not changeable data range.

Open attached file. Double-click chart to edit it. Click on "Data Ranges" or use File > Data Ranges. Try to change or add a data series. It is not possible.

To generate such chart from scratch do this:
Select all cells of the table.
Insert Chart. You get the wizard.
Selecxt type "Column".
Set "Dataseries in columns", "First rows as label" and "First column as label".
Remove data series "two" in step 3.
OK.

If you have left the dialog on first page of data range dialog, the range field is red, although it has no syntax error. You cannot switch to the other tab of the dialog.
If you have left the dialog on second page of data range dialog, what ever you do there, e.g. add the series "two", the OK button is never enabled.

Working with non-continues data ranges is OK in Version 4.0.1.2 (Build ID: 84102822e3d61eb989ddd325abf1ac077904985).

It is broken in  in Version: 4.4.7.2
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: en_US

[I thought such old problem will have already a bug report, but my search does not find any.]
Comment 1 m_a_riosv 2022-10-25 21:51:17 UTC
On your sample file, the range field it's, but deleting the chart and creating it again it shows fine for me the range.

Your range has:
Table1.A2:A4;Table1.B1:B4;Table1.D1:E4
instead
Table1.A1:A4;Table1.B1:B4;Table1.D1:E4

With the range right, after save and reopening A1 it's changed to A2.
Comment 2 m_a_riosv 2022-10-25 21:56:04 UTC
Even with something on the blank top left cell, the problem appears after save-reopen.
Comment 3 Stéphane Guillou (stragu) 2022-12-12 23:33:11 UTC
Reproduced with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 01c9c971e43782800ebf63acc763a7e7fba096c1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Expanding the range to include cell A1 makes the range valid again, however saving and reopening the file modifies again the range to exclude the cell, turns it red and disallows clicking OK or changing tabs.
Comment 4 raal 2022-12-13 17:56:40 UTC
This seems to have begun at the below commit.
Adding Cc: to Caolán McNamara; Could you possibly take a look at this one?
Thanks
 b19df640fe0fb7aa99d92fca2557bca267745f71 is the first bad commit
commit b19df640fe0fb7aa99d92fca2557bca267745f71
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sun Mar 15 04:07:40 2015 +0800

    source-hash-0d6f45377592a62ff4ee510d5fbd3bdd9e20160a
    
    commit 0d6f45377592a62ff4ee510d5fbd3bdd9e20160a
    Author:     Caolán McNamara <caolanm@redhat.com>
    AuthorDate: Wed Oct 15 09:52:01 2014 +0100
    Commit:     Caolán McNamara <caolanm@redhat.com>
    CommitDate: Wed Oct 15 10:53:52 2014 +0100
    
        coverity#1212509 Logically dead code
    
        this look very wrong, surely this is what was meant
    
        Change-Id: I461fc1a67770c733aee2f4379dcc252abd09b641
Comment 5 Caolán McNamara 2022-12-14 11:11:58 UTC
can certainly revert it then, the original state is still pretty weird so I guess solve it the other direction then
Comment 6 Commit Notification 2022-12-14 14:07:45 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6880d32d851783a56c977872df5fbf11b507876a

Resolves: tdf#151753 'revert coverity#1212509 Logically dead code'

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 7 Commit Notification 2022-12-14 15:37:01 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/89188837f60d83a901b2c43f73d30e1957920f50

Resolves: tdf#151753 'revert coverity#1212509 Logically dead code'

It will be available in 7.5.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 8 Commit Notification 2022-12-14 15:42:04 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/65e5486f6db884a5ef6e30abc41a6dc06d1cfb1a

Resolves: tdf#151753 'revert coverity#1212509 Logically dead code'

It will be available in 7.4.4.

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 9 Stéphane Guillou (stragu) 2022-12-15 07:59:21 UTC
Thanks Caolán, I can see that the range is not marked as invalid anymore. However, a follow up on it:

1. Open data ranges dialog
2. Add ";Table1.C1:C4" to the range to add a series
3. See that extra bar was added
4. Reopen data ranges dialog to see that range was simplified to "Table1.A2:A4;Table1.B1:E4" (still only top-left cell excluded from range)
5. Save, reload

Result:
"A" label is gone. Data range was changed to "Table1.A3:A4;Table1.B1:E4" (i.e. two first cells of column A have been excluded)

Any idea why that might be?
Comment 10 Caolán McNamara 2022-12-16 16:54:43 UTC
original problem should be solved.

I don't know what the problem in comment #9 is, but I see it in AOO too so I suspect its "inherited from OOO" and probably needs a new bug for that
Comment 11 Stéphane Guillou (stragu) 2022-12-16 19:07:24 UTC
Thanks Caolán. OOo-inherited issue is now in bug 152557.