Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
maternmi
Creator II
Creator II

change legend color


Hi,

who knows how I can change the color of legend? At the attached example you see that a color is connected to a change reason. But the connection will be done automatically. I would like to determine a color to a specific reason.

Thanks!

BR

Michael

5 Replies
stigchel
Partner - Master
Partner - Master

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

rgb(R,G,B)

The Dimension Reason should be included in the chart

Color:

LOAD Reason,

     R,

     G,

     B

FROM

BGColor.png

Colin-Albert

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.

colours.JPG.jpg

anbu1984
Master III
Master III

Chart Properties --> Color Tab

Based on color set in this tab affects Legend color

If you want to change color based on change reason, you can set at Background color of your expression

If(ChangeReason='X',Red(),Yellow())

jagan
Luminary Alumni
Luminary Alumni

HI,

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.

Regards,

Jagan.

Not applicable

Hi Michael,

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.