Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
udaya_kumar
Specialist
Specialist

Change Background Color of a bar chart based on some field

Hi,


I have an Inline field created in edit script by name consider Fruit.

It has values like All, Apple, Banana, Orange, Mango, Pineapple.

I have a database field by name FRUIT.

These two Fruit and FRUIT are linked in the script like

All,Apple

All,Banana

All,Orange

All,Mango

All,Pineapple

Apple,Apple

Banana,Banana

Orange,Orange

Mango,Mango

Pineapple,Pineapple

I am using Fruit field in my Listbox as filter and FRUIT as a dimension in the Bar Chart.

I have applied the background color for FRUIT in the expression in the Chart, background color.

It is working fine. but when we select any value from listbox like "Apple",

then only Apple is shown in red color in the chart and other values are shown in the basic blue color.

But it should show the color defined in the expressions even if user selects any value from Listbox.

How we can achieve this?

1 Solution

Accepted Solutions
udaya_kumar
Specialist
Specialist
Author

Hi all,

Thanks for the reply,

I tried with the help of my colleague.

We tried like the below code,

If(RowNo()=1, RGB(114,103,241),

If(RowNo()=2, RGB(243,70,1),

If(RowNo()=3, RGB(1,228,120),

If(RowNo()=4, RGB(2,208,206),

If(RowNo()=5, RGB(2,0,205),

If(RowNo()=6, RGB(253,153,203)

))))))

It worked for me

View solution in original post

5 Replies
neha_shirsath
Specialist
Specialist

Hi Uday,

Can you attach some data file? So that it will be more clear to understand.

sujeetsingh
Master III
Master III

ye ??

nirav_bhimani
Partner - Specialist
Partner - Specialist

HI,

Try this,

If ( WildMatch (Fruit , 'Apple'), RGB(0, 255, 0), RGB(192, 192, 192,) )

Or else try same condition in nested If

Regards,

Nirav Bhimani

Anonymous
Not applicable

This post may offer a solution, by adding the RGB code into the data model, and assosicating to the required dimensions: http://community.qlik.com/message/291658#291658

Jonathan

udaya_kumar
Specialist
Specialist
Author

Hi all,

Thanks for the reply,

I tried with the help of my colleague.

We tried like the below code,

If(RowNo()=1, RGB(114,103,241),

If(RowNo()=2, RGB(243,70,1),

If(RowNo()=3, RGB(1,228,120),

If(RowNo()=4, RGB(2,208,206),

If(RowNo()=5, RGB(2,0,205),

If(RowNo()=6, RGB(253,153,203)

))))))

It worked for me