Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
punitpopli
Specialist
Specialist

Colour to dimension values from Colour palettes

Hi All,

Does anyone know how QlikView assigns colour to the dimension values from the colour palette

Issue :

I have a cyclic group in which I have multiple dimensions and the colour palette has all calculated colours,screen shot below for reference.

palette.png

But in cyclic group the colour is getting assigned randomly, screen shot below for reference.

chart.png

Have anyone face similar issue or is there any workaround to get the colour assigned to the dimensions in the order of colour palette as have?

Thanks

Punit

10 Replies
punitpopli
Specialist
Specialist
Author

Hi All,

Does anyone has face the same issue in the past?

-Punit

stigchel
Partner - Master
Partner - Master

The colors from the palette are assigned in order of the dimensions\expression(s). Furthermore, the caluclated colors in the color tab are NOT aware of the dimension values. This means that you can not check for dimension values here.

For linking the colors to the dimension values, use the background color option of the expression instead. Click on the plus sign in front of the expression to expand the options and use the background color option.

BGColor.png

Not applicable

Can you share the Dimensions and Expressions.

It will be helpful in getting the solution quickly.

Thanks Nithin

punitpopli
Specialist
Specialist
Author

Hi Stigchel

I am using a cyclic dimension which contains around 5-6 dimensions in it and it would be difficult to maintain the expressions for all the dimensions values in the cyclic group

What i need here is when the dimension values are in the order 18,50,65 and Unknown then the color order from the color palette would be  blue1, blue2, red and green instead of blue2, blue1, purple and brown (please refer the screen shot in above)

Let me know if you need any other information on this.

-Punit

MarcoWedel

Hi,

instead of a dynamic palette maybe a solution could be:

QlikCommunity_Thread_181647_Pic1.JPG

QlikCommunity_Thread_181647_Pic2.JPG

QlikCommunity_Thread_181647_Pic3.JPG

QlikCommunity_Thread_181647_Pic4.JPG

tabAgeGroups:

LOAD AutoNumberHash128(MinAge, MaxAge) as %AgeGroup,

     Dual([AGE GROUP],MinAge) as [AGE GROUP],

     MinAge, MaxAge, Color

INLINE [

    AGE GROUP, MinAge, MaxAge, Color

    18-49 Years, 18, 49, Blue

    50-64 Years, 50, 64, LightBlue

    65+ Years, 65, 150, Red

    Unknown, 200, 200, Green

];

tabPersons:

LOAD *,

     Alt(Age,200) as AgeMatch;

LOAD RecNo() as PersonID,

     If(Rand()>0.2,18+Floor(Rand()*100)) as Age,

     Date(AddMonths(MakeDate(2013),Floor(Rand()*36)),'MMM-YY') as MONTH

AutoGenerate 5000;

Left Join (tabPersons)

IntervalMatch(AgeMatch)

LOAD MinAge, MaxAge

Resident tabAgeGroups;

Left Join (tabPersons)

LOAD Distinct

     MinAge, MaxAge,

     AutoNumberHash128(MinAge, MaxAge) as %AgeGroup

Resident tabPersons;

DROP Fields MinAge, MaxAge, AgeMatch;

hope this helps

regards

Marco

punitpopli
Specialist
Specialist
Author

Hi,

Thanks for your response.

In my current application it would be very difficult to manage large number of mappings as you have implemented in the post above. I have many sources with same column names and it would be difficult to maintain that number of color codes in the script

Can we have the color from the palette assigned to the dimension value in the order defined in the palette?

The color from the palette to remain constant i.e. the order 18,50,65 and Unknown then the color order from the color palette would be  blue1, blue2, red and green instead of blue2, blue1, purple and brown (please refer the screen shot in above)

-Punit

MarcoWedel

Hi,

maybe you could try with the "persistent colors" option:

QlikCommunity_Thread_181647_Pic5.JPG

QlikCommunity_Thread_181647_Pic6.JPG

or a static relation between age groups and colors defined in a background color expression:

QlikCommunity_Thread_181647_Pic7.JPG

hope this helps

regards

Marco

punitpopli
Specialist
Specialist
Author

Hi Macro,

Thanks for your response.

Persistent color option doesn't solve my problem.

The color are assigning randomly to the dimension values as they are loaded in QlikView in that particular order and if (in my case) we have to assign the color in the specified order from the palette then we have to order the column in ASC/DESC from the script itself i.e. we can use Order by clause for the dimension (s) we are using in the cyclic group.

Hope this will help all.

Thanks,

Punit

MarcoWedel

Hi,

you could include

Autonumber(yourdimensionfield) as yourfieldID

and use a color expression like

Color(yourdimensionfieldID)

to always get the same color for your dimension values.

hope this helps

regards

Marco