Bug 128747 - FILEOPEN DOCX Chart has different legend entry text
Summary: FILEOPEN DOCX Chart has different legend entry text
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.4.0
Keywords: bibisected, bisected
Depends on:
Blocks: OOXML-ComboChart
  Show dependency treegraph
 
Reported: 2019-11-12 13:50 UTC by NISZ LibreOffice Team
Modified: 2022-03-16 09:30 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of the document in Writer 4.2 (51.82 KB, image/png)
2019-11-12 13:51 UTC, NISZ LibreOffice Team
Details
Screenshot of the document in Writer 4.3 (48.28 KB, image/png)
2019-11-12 13:51 UTC, NISZ LibreOffice Team
Details
Screenshot of the document in current Writer master (59.30 KB, image/png)
2019-11-12 13:51 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2019-11-12 13:50:36 UTC
Description:
This is split from bug #127586
The chart in attachment #154208 [details] has a data series that has a different legend text than in Word.


Steps to Reproduce:
1.	Open attachment #154208 [details] and check its screenshot on attachment #155602 [details]

Actual Results:
The data series represented by the grey area chart has the legend entry „"If oversubscription relative to allowance increase..." in Word but that becomes „Likely funding required” in Writer. This is also displayed when the data table is opened.

Expected Results:
The same legend text appears.


Reproducible: Always


User Profile Reset: No



Additional Info:
LibreOffice details:
Version: 6.4.0.0.alpha1+ (x86)
Build ID: 80109586e6cb6d3e2e0a53a9079c3125ec9b8368
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win; 
Locale: hu-HU (hu_HU); UI-Language: en-US
Calc: CL

Also happens in:

Version: 4.4.0.3
Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Locale: hu_HU
- This and newer versions have the “Likely funding required” text as data column name

Verzió: 4.3.0.4
Build az.: 62ad5818884a2fc2e5780dd45466868d41009ec0
- This has the “Likely funding required” text as a data point label

But not in:
Verzió: 4.2.0.4
Build az.: 05dceb5d363845f2cf968344d7adab8dcfb2ba71
- This has the same legend text for the data series as Word
Comment 1 NISZ LibreOffice Team 2019-11-12 13:51:10 UTC
Created attachment 155746 [details]
Screenshot of the document in Writer 4.2
Comment 2 NISZ LibreOffice Team 2019-11-12 13:51:28 UTC
Created attachment 155747 [details]
Screenshot of the document in Writer 4.3
Comment 3 NISZ LibreOffice Team 2019-11-12 13:51:48 UTC
Created attachment 155748 [details]
Screenshot of the document in current Writer master
Comment 4 NISZ LibreOffice Team 2019-11-12 13:53:52 UTC
Additional Information: 

Bibisected using bibisect-win32-4.3 to: 
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=6e31feb0f09f2dc9a9cd10e77ef884e000e1b32b 
author	Kohei Yoshida <kohei.yoshida@collabora.com>	2014-06-12 11:24:30 -0400
committer	Kohei Yoshida <kohei.yoshida@collabora.com>	2014-06-12 11:32:17 -0400
summary: fdo#77506: More reliable way to determine label strings.
Comment 5 NISZ LibreOffice Team 2019-11-12 13:54:24 UTC Comment hidden (obsolete)
Comment 6 Xisco Faulí 2019-11-27 14:52:03 UTC
Reproduced in

Version: 6.5.0.0.alpha0+
Build ID: 3a6f270edfffb97763927b2732feacedbdac1e80
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 7 Justin L 2022-03-02 04:33:35 UTC
removing "regression" because before this half of the labels were missing, so if one thing happened to be in the right place, it likely was simply miraculous.
Plus, the code that was being replaced was horrendous and hacky beyond belief.

I think the problem is related to column C and D being empty. There is only the string Reference for those columns.

The problematic column is the first in read-order in the file, followed by the two empty ones. It is picking up the strRef of the last empty column.

I think the identified commit is a complete red herring. As far as I can see, the entire chart passed to this file already only has 4 columns (instead of 6), and the desired label string is not included in any of these four columns. So I expect the code to be in a completely different place.
Comment 8 Justin L 2022-03-02 13:39:15 UTC
Another dead end appears to be oox/source/drawingml/chart/seriesconverter.cxx
Reference< XDataSeries > SeriesConverter::createDataSeries()'s
            if (!nDataPointCount)
                // No values present.  Don't create a data series.
                return Reference<XDataSeries>();
which happens twice after label "If oversubscription relative to allowance increases at the same average rate B15-B17"

Unrelated (connected to Axis Title and Chart Title) are two
"warn:legacy.osl:oox/source/drawingml/chart/titleconverter.cxx:173: TitleConverter::convertFromModel - multiple text properties"

The read-order is definitely at play here somehow. If I swap around the empty "Likely funding required" and "Oversubscription rate" around in chart1.xml, then the label changes.
Comment 9 Justin L 2022-03-03 13:23:45 UTC
After 3 days of looking, I finally found the spot
in chart2/source/tools/InternalDataProvider.cxx:

else if (rRole == u"label")
{
    // Data series label.  There should be only one element.  This always
    // goes to the last data column.
    sal_Int32 nColSize = m_aInternalData.getColumnCount();
    if (!aRawElems.empty() && nColSize)
    {
        std::vector<uno::Any> aLabels(1, uno::Any(aRawElems[0]));
        m_aInternalData.setComplexColumnLabel(nColSize-1, std::move(aLabels));
Comment 10 Justin L 2022-03-04 06:36:15 UTC
proposed fix at https://gerrit.libreoffice.org/c/core/+/130946
Comment 11 Commit Notification 2022-03-16 09:29:04 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#128747 chart2: don't overwrite labels

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