Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

maternmi
Contributor 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
Honored Contributor

Re: change legend color

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

Re: change legend color

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
Honored Contributor III

Re: change legend color

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())

MVP
MVP

Re: change legend color

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

Re: change legend color

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.

Community Browser