Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to make my chart bar color Q1 alway Green color ?

Hi All

May i know how to make my chart display as below :-

1. Q1 bar = Green color

1. Q2 bar = Blue color

1. Q3 bar = Yellow color

1. Q4 bar = Red color

Now all bar are black

Paul

1 Solution

Accepted Solutions
ankit777
Specialist
Specialist

Hi,

You can add following expression at background color

if (quarter='Q1',green(),

if (quarter='Q2',blue(),

if (quarter='Q3',yellow(),

if (quarter='Q4',red())))

View solution in original post

8 Replies
paulyeo11
Master
Master
Author

Hi All

Enclosed my QV Doc

ankit777
Specialist
Specialist

Hi,

You can add following expression at background color

if (quarter='Q1',green(),

if (quarter='Q2',blue(),

if (quarter='Q3',yellow(),

if (quarter='Q4',red())))

Not applicable

=if(Quarter = 'Q1', Green(),

    if(Quarter = 'Q2', Blue(),

        if(Quarter = 'Q3', Yellow(),

            if(Quarter = 'Q4', Red()))))

in Expression background would work

ankit777
Specialist
Specialist

Hi,

Use this expression

=
if (left($(ColumnDim_p),2)='Q1',green(),

if (left($(ColumnDim_p),2)='Q2',blue(),

if (left($(ColumnDim_p),2)='Q3',yellow(),

if (left($(ColumnDim_p),2)='Q4',red()))))

paulyeo11
Master
Master
Author

Hi Sir

I try your expression into my actual qv qvw file ,  I got the chart with many color. where i did wrong ?

qtr.png

awhitfield
Partner - Champion
Partner - Champion

Hi Paul,

Change your background colour expression of your bar expression to the following:

if(wildmatch(YearQtr,'Q1-*'),Green(),
if(wildmatch(YearQtr,'Q2-*'),Blue(),
if(wildmatch(YearQtr,'Q3-*'),Yellow(),
if(wildmatch(YearQtr,'Q4-*'),Red()))))

HTH Andy

Not applicable

It looks like, you are using stacked bar with two dimension. So, I Don't think, coloring entire bar, which has different dimension value would work.

This would work only in case of single dimension bar graph.

paulyeo11
Master
Master
Author

Hi All

it work fine now , after copy the expression to my actual qv doc , now it work fine. ( I cannot remember what did i try )

Thank you all

Paul