First load a new link table with the reason (linked to your data reasons) and three fields e.g. R,G and B. The values in these fields should correspond to the desired RGB values. Then in the backgound color of your expression (click on the + before the expression to expand the attributes) use
The Dimension Reason should be included in the chart
The chart colours are controlled by the Colors tab on the Chart Properties.
The first Dimension will use Colour1, the second Colour2 etc. as determined by the sort order.
You can also enable Persistent Colours which means that the same colour for each dimension, will be used across charts that share the same dimensions.
Try like this
Chart Properties -> Expression -> Click on Expression + -> Click on Background color and give expression below
=Pick(Match(DimensionName, 'Value1', 'Value2', 'Value3'), RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255))
Replace DimensionName with your actual dimension name and 'Value1', 'Value2', 'Value3' with your actual values.
You could create a Inline Table with the RGB code. For each row in inline table you put your key, the R, G and B components.
Something like these:
LOAD * INLINE [
Dim1, DimColor_R, Dim1Color_G, Dim1Color_B
A, 255, 0, 0
B, 0, 255, 0
C, 0, 0, 255
After, you could change the Background Color for your Expression (expand expression in the plus sign), to this:
=RGB(DimColor_R, Dim1Color_G, Dim1Color_B)
And it's done.
I'm attaching a example.
Legend Color.qvw 191.5 K