Bug 97802 - Chart categories : manually set strings (not references to table) are allowed but not used
Summary: Chart categories : manually set strings (not references to table) are allowed...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:ooxml
Depends on:
Blocks: OOXML-Chart
  Show dependency treegraph
Reported: 2016-02-12 15:22 UTC by Serg
Modified: 2022-12-02 13:53 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Invalid category names (888.29 KB, image/png)
2016-02-12 15:22 UTC, Serg
ODS file to test (15.00 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-11-28 11:05 UTC, Stéphane Guillou (stragu)

Note You need to log in before you can comment on or make changes to this bug.
Description Serg 2016-02-12 15:22:13 UTC
Created attachment 122581 [details]
Invalid category names

1) Create new table, e g with data:
1	4	2
2	3	1
3	2	2
4	1	1

2) select this range 

3) add column chart 

4) Right-click on X-Axis -> select "Data Ranges..."

5) Change categories to: "Caaaa1","C2","C3"

6) Click OK

7) It's still "1 2 3" in categories names.

Moreover, if you try to load proper XLSX with manually set category names - the resut will be the same - "1 2 3 ..."
Comment 1 Buovjaga 2016-02-16 11:03:05 UTC
Yes, it doesn't change the X axis labels.
The correct form least for me is: "Caaaa1";"C2";"C3" so semicolons instead of commas. Otherwise the background of the input field was red. But it doesn't work..

I tried in 3.5, but there the background of the input field was red with commas or semicolons and it would not accept the categories.

Serg: set the version to the earliest you saw the problem in.

Win 7 Pro 64-bit Version:
Build ID: a6f876d45bd4e41a7143594a6cb11b6893a0f620
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-02-11_00:07:38
Locale: fi-FI (fi_FI)
Comment 2 QA Administrators 2017-03-06 15:24:16 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2019-12-03 14:57:07 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2022-01-29 03:54:52 UTC Comment hidden (obsolete)
Comment 5 Stéphane Guillou (stragu) 2022-11-28 11:03:35 UTC
With a master build from today, custom categories:

- Are accepted but not shown when separated by commas (e.g. "Caaaa1","C2","C3","kk")
- Are not accepted at all when separated by semicolons (e.g. "Caaaa1";"C2";"C3";"kk")

Adding UX to the conversation, as I am not sure if custom labels entered by hand should even be accepted. The documentation makes it sound like only ranges should be accepted: https://help.libreoffice.org/7.5/en-US/text/schart/01/wiz_data_series.html

Version: (X86_64) / LibreOffice Community
Build ID: 1fd42472e2b1a2169d56e62ef11aa7ee1f7815e7
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 6 Stéphane Guillou (stragu) 2022-11-28 11:05:35 UTC
Created attachment 183852 [details]
ODS file to test

To test:

1. Open ODS file
2. Double-click on chart to enter edit mode
3. Right click on X axis > Data ranges...
4. Data series tab
5. Change Categories value do a custom vector of strings
Comment 7 Heiko Tietze 2022-11-29 09:29:17 UTC
When I try to type some vector the application crashes with the second item (A;B). But if I enter the labels into cells like E1:E4 and select this range everything works as expected.

One could now argue to block direct editing. But that would be awkward in many other cases. For example I collect continuous data and add it on top of the sheet (don't want to scroll). Inserting a row on top moves the chart content/range and I have to update manually. Given the chart is a bit more complex it's much easier to update per direct editing than doing the range selection.

My take: fix the bugs and block crashes. If users enter inappropriate values to fields it should be shown and not accepted.

Version: / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 8; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 8 Eike Rathke 2022-11-29 21:44:53 UTC
This is a hairy mess.. The range selector was supposed to not support anything but cell range references, where the list separator used is the function parameter separator, so whether it's ',' or ';' depends on configuration. Later in 2012 an import of static literal category labels from .xlsx was added, but only half i.e. it does not work through the UI nor in any of the data sequences obtaining code. Additionally, that check whether content/input is valid accepts any badly formed string, not only string literals. Even worse, the check is valid in any of the reference input fields, not just categories. Worse yet, the interface used by Chart is part of the public API so simply changing it for just the categories case isn't possible but probably would need an optional additional API.
Comment 9 Stéphane Guillou (stragu) 2022-11-30 11:04:30 UTC
Complex one indeed. Thanks for the history, Eike!

Changing blocked meta to "OOXML charts" as this is first and foremost an interoperability / filter issue.

Also, related to complex axis label categories + custom strings *for the Name field*, there's this regression: Bug 142346

I couldn't reproduce the crash Heiko describes though:

(In reply to Heiko Tietze from comment #7)
> When I try to type some vector the application crashes with the second item
> (A;B).

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

Version: / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: de-DE (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 10 Eike Rathke 2022-11-30 16:55:38 UTC
It gets even worse.. the xlsx compatibility thing needs to accept an unquoted word (that is not a named range) as "Range for Names" which will be displayed as label, I stumbled over that sc/qa/uitest/chart/tdf98690.py test when trying to narrow things down to accept only properly quoted string. That appears to have been (unintendedly?) implemented with the commit https://bugs.documentfoundation.org/show_bug.cgi?id=142346#c4 points to.

For the crash Heiko mentioned, I experienced an occasional crash but could not reproduce it yet.
Comment 11 Eike Rathke 2022-11-30 17:42:46 UTC
The more I think about it the more I am convinced that the tdf98690.py test tests a broken document (https://bugs.documentfoundation.org/attachment.cgi?id=123610 of bug 98690 saved already broken by LibreOffice) and so far only worked by accident. Those names can not be unquoted whatever strings, probably not even in Excel as there they'd have to fulfil the expression constraints as well.
Comment 12 Heiko Tietze 2022-12-01 10:32:44 UTC
(In reply to Eike Rathke from comment #10)
> For the crash Heiko mentioned, I experienced an occasional crash but could
> not reproduce it yet.

Cannot make master crash, and 7.4 is has no debug info. Neither it crashes when started from the command line! Very elusive bug.
Comment 13 Heiko Tietze 2022-12-02 13:53:19 UTC
Stumbled over the need to edit the data range field: if a chart is defined as $Sheet1.$A$1:$A$10 it's not possible to ctrl+click select/unselect individual cells via the range definition. One has to enter manually $Sheet1.$A$1;$Sheet1.$A$3;$Sheet1.$A$7:$A$10.