Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jesstungleumi
New Contributor III

Qlik Sense Color in Line Chart

Hi I want to color the line chart: above avg (reference line) as yellow, below avg as green. How can I do it? I tried color by measure with palette but was stuck with limited choices, I tried color by expression but get the whole line as green. Thanks in advance.LineChart.PNG

9 Replies
shraddha_g
Honored Contributor III

Re: Qlik Sense Color in Line Chart

What was the expression you used for color by expression?

felipedl
Valued Contributor III

Re: Qlik Sense Color in Line Chart

Hi Jessica,

Just do something like this for the expression in the Color by expression:

if(avg(Value)<0,red(),green()))

For some sample data i've put together, it gets me

Sample.png

Re: Qlik Sense Color in Line Chart

There is color section separate for "Reference Lines" you can pick any one from there

ishanbhatt
Contributor II

Re: Qlik Sense Color in Line Chart

Hi Jessica,

In Appearance property, you will find Color and legend section. In that select custom color and choose 'By expression' option from the dropdown list.

Then write below expression in expression space.

=if(Avg([Field Name)>133,Yellow(),Green()) .

Maybe this will solve your issue.

jesstungleumi
New Contributor III

Re: Qlik Sense Color in Line Chart

Hi Anil I see the feature in available in Nov 2017. But this color setting is for reference line, I am looking for a way to color the measure. Thanks.

jesstungleumi
New Contributor III

Re: Qlik Sense Color in Line Chart

Hi Ishan, this worked for static value. But if I replaced 133 with dynamic reference line expression it didn't work. Thanks.

jesstungleumi
New Contributor III

Re: Qlik Sense Color in Line Chart

Hi Felip, this worked for static value. But if I replaced 133 with dynamic reference line expression it didn't work.

omarbensalem
Esteemed Contributor

Re: Qlik Sense Color in Line Chart

well:

do

=if(Avg([Field Name)>YourExpressionForTheReferenceLine,Yellow(),Green()) .

jesstungleumi
New Contributor III

Re: Qlik Sense Color in Line Chart

I added "all" in the dynamic reference line calculation and it worked. The reference line expression was to sum up the measure across the months and divide by month count. The reference line took the calculation without "all" because it was not impacted by dimension. Coloring condition was impacted by dimension though. So adding "all" would remove dimension impact. Thank you all for the input!