Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

berryandcherry6
Contributor II

Applying Color gradient for Bar Chart in Qliksense

Hi,

i have a Bar graph where i need to apply gredient color lets take Blue,

Currently i have like this

Capture1.PNG

i want like below image, with one bar light, second middle light and third dark

Bar Chart.PNG

How i should adjust in color and legend setting.

Please help me on this.

1 Solution

Accepted Solutions
berryandcherry6
Contributor II

Re: Applying Color gradient for Bar Chart in Qliksense

Hi All,

I got this worked out by below expression

ColorMix2( (rank(New_Campaign_Name)/(noofrows(TOTAL)/6))-1 ,rgb(0,112,200),rgb(142,180,227),rgb(198,217,241))

My colleague suggested this idea.

This depends on number of Dimension values i.e New_Campaign_Name by giving its rank.

But the problem is we cant display legend for this chart. Because we are customizing the color of charts. Do you have any idea on this to display legend with customized color. In community they say its a Bug in Qliksense. Any work around? .

9 Replies
satheshreddy
Contributor III

Re: Applying Color gradient for Bar Chart in Qliksense

Hi Supriya,

like this you want out put?

colors.PNG

Chart Settings-->Appearance----> colors and legend--->select custom ---> scroll down and select Range custom.

Regards

Sathish

shraddha_g
Honored Contributor III

Re: Applying Color gradient for Bar Chart in Qliksense

if you are using qliksense higher than 3.2,

then you can set whatever color you want to set for measure in master Dimension/master

omarbensalem
Esteemed Contributor

Re: Applying Color gradient for Bar Chart in Qliksense

You should use colormix function in this case.

Do you have QlikView installed?

If you do have, use the QlikView assistant to build up your colorMix function then copy it:

Capture.PNG

Capture.PNG

Than choose your measure:

Capture.PNG

and limits:

Capture.PNG

It would be sthing like this: change sum(Salaire) by your measure:

ColorMix1 ((1+Sign(2*(sum(Salaire)-RangeMin (top(total sum(Salaire),1,NoOfRows(total))))/(RangeMax (top(total sum(Salaire),1,NoOfRows(total)))-RangeMin (top(total sum(Salaire),1,NoOfRows(total))))-1)*Sqrt(Fabs((2*(sum(Salaire)-RangeMin (top(total sum(Salaire),1,NoOfRows(total))))/(RangeMax (top(total sum(Salaire),1,NoOfRows(total)))-RangeMin (top(total sum(Salaire),1,NoOfRows(total))))-1))))/2, ARGB(255, 121, 188, 255), ARGB(255, 0, 86, 128))



and please mto‌, if you could integrate colormix assistant into QlikSense, it would be really great ! Thanks,

Omar,

berryandcherry6
Contributor II

Re: Applying Color gradient for Bar Chart in Qliksense

Hi,

Thanks for reply

I am using Qliksense 3.2

But colormix code gives me like this. 

Check here, we have two dimension over here and one expression.  Here all Campaign 03/28 should be Light Blue,Campaign 04/04 should be Medium Blue,Campaign 04/11 should be Dark Blue for each dimension

Capture2.PNG

Please check attached qvf file,

shraddha_g
Honored Contributor III

Re: Applying Color gradient for Bar Chart in Qliksense

you can define that in Master section..

there you can set colors

berryandcherry6
Contributor II

Re: Applying Color gradient for Bar Chart in Qliksense

Hi Shraddaha,

Thanks for reply.

Can you show me how. When i enter into master items, it shows me to enter expression, description and pick color.

But i am not understanding what should be my expression over there?

Can you please show me how. It will be very help full

omarbensalem
Esteemed Contributor

Re: Applying Color gradient for Bar Chart in Qliksense

In that case, you simply enter this formule:

if(subfield(New_Campaign_Name,'-',1)='Campaign 03/08 ','#2dbbca'

,if(subfield(New_Campaign_Name,'-',1)='Campaign 04/04 ',lightblue(),

if(subfield(New_Campaign_Name,'-',1)='Campaign 04/11 ',blue()

)

))

Check the attached app:

Capture.PNG

!

berryandcherry6
Contributor II

Re: Applying Color gradient for Bar Chart in Qliksense

Hi Omer,

Yes, that's work only if New_Campaign_Name dimension is Static.

But New_Campaign_Name is dynamic. New_Campaign_Name differs in its name. So i think i cant compare as shown.

berryandcherry6
Contributor II

Re: Applying Color gradient for Bar Chart in Qliksense

Hi All,

I got this worked out by below expression

ColorMix2( (rank(New_Campaign_Name)/(noofrows(TOTAL)/6))-1 ,rgb(0,112,200),rgb(142,180,227),rgb(198,217,241))

My colleague suggested this idea.

This depends on number of Dimension values i.e New_Campaign_Name by giving its rank.

But the problem is we cant display legend for this chart. Because we are customizing the color of charts. Do you have any idea on this to display legend with customized color. In community they say its a Bug in Qliksense. Any work around? .