Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
paulyeo11
Valued Contributor II

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
Valued Contributor

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

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

8 Replies
paulyeo11
Valued Contributor II

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

Hi All

Enclosed my QV Doc

ankit777
Valued Contributor

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

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

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

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

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

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

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

in Expression background would work

ankit777
Valued Contributor

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

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
Valued Contributor II

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

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
Esteemed Contributor

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

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

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

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
Valued Contributor II

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

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

Community Browser