Bug 144985 - Chart custom colors are not used in the legend
Summary: Chart custom colors are not used in the legend
Status: RESOLVED DUPLICATE of bug 96332
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Chart-Legends
  Show dependency treegraph
 
Reported: 2021-10-07 18:56 UTC by Jean-Francois Nifenecker
Modified: 2022-11-17 13:33 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
A chart with custom colors and a legend (16.88 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-10-07 18:56 UTC, Jean-Francois Nifenecker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Francois Nifenecker 2021-10-07 18:56:15 UTC
Created attachment 175581 [details]
A chart with custom colors and a legend

When setting custom colors for the data range (fill color), the newly used colors are not used in the legend, where the standard ones are still present.
See attachment.

Checked present under Linux and Windows (same version, see below).

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded
Comment 1 Deep17 2021-11-05 17:00:45 UTC
When I open the attached file in Microsoft Excel, I see the chart open with standard legend colors.

When I open the attached file in calc, It shows custom colors on chart and standard ones are in legends. But if I tried to edit and give custom colors on chart I can see the custom colors on legends too.

Version: 7.2.2.2 (x64) / LibreOffice Community
Build ID: 02b2acce88a210515b4a5bb2e46cbfb63fe97d56
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 542a38de1a071f54f61806683dafea84e43edce9
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 2 Jean-Francois Nifenecker 2021-11-06 08:34:08 UTC
The chart colors are set using a range (here: E2:E5). See the Data ranges definition (Edit mode > right click > Data ranges). The Data series tab has values for Border color and Fill color. Note that the Data range tab, Data range box, has a provision for the given colors ranges ($Sheet1.$A$2:$B$5;$E$2:$E$5)) 
 
I've tried changing the colors in the color range, to no avail: the data areas change colors but not the legend. Here's the bug, imo.

But, when I set the colors directly:
0. Remove the color range (remove the ;$E$2:$E$5 part in the Data rage spec, then remove the Fill colors and Border colors values)
1. Select the data points one by one
2. Set their colors by Right-Click > Format data point
then the new colors are correctly propagated to the legend.

This shows the bug, I'd say. The user wants to automate the colors setting by specifying a "color palette" she sets somewhere in the sheet (here E2:E5).

Version: 7.1.3.2 / LibreOffice Community
Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: 

(but present in former versions)
Comment 4 himajin100000 2021-11-06 14:27:16 UTC
https://opengrok.libreoffice.org/xref/core/chart2/source/controller/dialogs/tp_DataSource.cxx?r=5b0ae3b5#803

I haven't looked further into the code, but it seems I have to know the difference between "Series" and "Roles".
Comment 6 himajin100000 2021-11-07 21:34:18 UTC Comment hidden (obsolete)
Comment 7 himajin100000 2021-11-07 21:34:45 UTC
Oops, posted on wrong report.
Comment 8 Buovjaga 2022-11-17 13:33:23 UTC
(In reply to Jean-Francois Nifenecker from comment #2)
> The chart colors are set using a range (here: E2:E5). See the Data ranges
> definition (Edit mode > right click > Data ranges). The Data series tab has
> values for Border color and Fill color. Note that the Data range tab, Data
> range box, has a provision for the given colors ranges
> ($Sheet1.$A$2:$B$5;$E$2:$E$5)) 
>  
> I've tried changing the colors in the color range, to no avail: the data
> areas change colors but not the legend. Here's the bug, imo.

I tested by removing the .$E$2:$E$5 from the Fill Color. Already seen in oldest of 44max bibisect repo on Linux. In earlier versions the chart doesn't use the colours at all.

Stéphane found a duplicate, so let's close this one.

*** This bug has been marked as a duplicate of bug 96332 ***