I have a stacked bar chart in LibreOffice Calc (v25.8, Win 10) with the data series in columns. For various reasons, I don’t want to use Calc’s default color palette. The “Range for Fill Color” on the Data Series tab in the Data Ranges dialog would allow me to define a color for each separate element in each data series, but that’s overkill. I just want the SAME color for all elements in a given series, and I want to choose that color programmatically. I want to place a formula "=COLOR(R,G,B) in a single cell above each column to define the color for all elements in the column below it. Intuitively I’d specify that single cell in the “Range for Fill Color” field, but that’s not how it works: it applies that color to just one element of the series. All other elements get the default color palette.
I’d appreciate any suggestions on how to do this other than manually formatting each data series. That approach doesn’t enable one to programmatically assign a color to a given data series, for example.
Does this answer help? how set colors for color and fill in charts - #9 by ChameleonScales
StackedBarDefineColours.ods (30.6 KB)
No, this doesn’t help. I’m aware of how to set colors for individual elements of a data series… But if I want to set the same color for all of the elements, why can’t this be done with just a single cell, rather than having to use a full range of identical color codes?
Dunno.
.
You have to change the value in only one cell to effect the colour change, the “identical color codes” are just formulas that do the conversion from hexadecimal.
Maybe it looks better like this, change any of the RGB colour numbers and watch the chart update.
StackedBarDefineColoursV2.ods (30.5 KB)
I guess the alternative would be to create a theme although you would be limited to 6 colours
Note that in your example spreadsheet the LEGEND colors are NOT the same as the corresponding data series. The legend ignores the “Range for Fill Color” setting, and continues to draw from the default color palette. With such a significant error, it cannot be considered a solution, nor even a viable workaround.