Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qlik_venu
Creator
Creator

Color : Persisten color issue

Hi,

I have defined persistent color option for my charts.

The field I use for the chart has more than 30 unique values. Though the field color is maintained across the charts, I am facing an issue of the color getting repeated as we can define the colors for 18 of them in the color tab.

I have many dimensions for which I might have to map individual colors if I have to do it manually.

Also my dimensional values are dynamic so defining color for dimensional value will require lots of maintenance.

Is there any way to overcome this. ?

Thanks,

Venu


5 Replies
francoiscave
Partner - Creator III
Partner - Creator III

Hi Venu,

You can load a table with your RGB statement like below:

Load * inline [

Dimension, R,G,B

France, 255,152, 145

Germany,125,154,165

...

];

And use the RGB() function like RGB(R,G,B).

Have fun with QV,

François

qlik_venu
Creator
Creator
Author

Hi Francois,

The only issue here is my dimensional values are not static. defining a RGB color mapped to the dimensional values would require frequent maintenance.

Or is there anyway we can assign the colors to a particular order for the dimensional fields at the script level.

like

Field 1 = rgb(color1)

Field 2 = rgb(color2)

thanks,

Venu'

francoiscave
Partner - Creator III
Partner - Creator III

Venu,

We can maybe create your RGB_Table dynamicaly...

I propose this:

Dimension:

Load

     DimensionField,

     *

From Source.qvd;

Load Distinct

     DimensionField,

     Floor(Rand()*256) as R,

     Floor(Rand()*256) as G,

     Floor(Rand()*256) as B

Resident Dimension;

Have fun with QV,

François

stigchel
Partner - Master
Partner - Master

That should be possible, but I would not use Rand() as Francois suggests. Some colors are hardly visible and or look too much like each other. To have somewhat more control I would suggest to load a list of say 50 numbered colors (or as much as you max need) that you determine yourself. Then in the color expression use the FieldIndex function to get an index of your dimension value and use that to get the corresponding numbered color from the color table you loaded

francoiscave
Partner - Creator III
Partner - Creator III

Venu,

Have you need some more help ?

If not, can you mark an answer as Correct or helpful to close this thread.

Thanks,

François