Qlik Community

QlikView Documents

Documents for QlikView related information.

Use Silent Legend with Cross Colors

pljsoftware
Contributor III

Use Silent Legend with Cross Colors

When I create a dashboard to mantain a good layout and to offer a good user experience always I need to set the same color for the same dimension value in each chart.

Unfortunally there isnt' a easy way to do this, and often a solution is to create some additional fields (R,G,B) for each dimension.

I don't like to have dozens of fields in my model with the problem to naming them.

To turn around this problem, I writed a single expression in a variable that doing all for me and now I use it always.

Let's see if you like this method too.

The idea is to use the functions Pick(Match(...)) to realize the magic.

I use QlikView Test Script and Qlikview Components library to realize an example. Test Script create the dimensions Dim1, Dim2, Dim3 and the expressions.

For Dim1 the values are A, B, C

For Dim2 the values are a, b, c, d, e, f

For Dim3 the values are X, Y, Z

For each values in dimensions need to set a variable with the associate color, to do easy this I use ColorTheme.xlsm file and use Qvc.ColorTheme to read it.

Now the best point... our function Pick(Match(...)), that I called App.Color.GetForField and set the value in Settings.xlsx.

Here the value:

=Pick(Match(Only($(=$1)), ' & Chr(39) & Concat({1} DISTINCT $(=$1), Chr(39) & Chr(44) & Chr(39)) & Chr(39) & '), ' & PurgeChar( Replace(  'App.Color.v.Dimension.$(=$1).' & Concat({1} DISTINCT $(=$1), chr(10) & ',App.Color.v.Dimension.$(=$1).') , ' ', '_'), '[]') & ')'

To use it in a chart write $(=$(App.Color.GetForField('[Dim1]'))) in the expression's backgroud property

The values in specificated dimension get automatically choosed color.

I hope you like this.

Regards

Luca Jonathan Panetta

Attachments
Comments
Partner
Partner

Quite interesting to load up a color scheme to specific dimensions.

Only thing I see as restrictive is that in some cases there are multiple values for a specific dimension and if I understood correctly you would have to address all variations to fill the ColorScheme -> // Dimension Portion.

If you have quite a few, it would be easy to setup them, other than that, nice automatic approach to get the colors into the app.

0 Likes
pljsoftware
Contributor III

Hi Felip,

of course all values in a dimension need to list as variables (App.Color.v.Dimension.YourDimensionName.DimValue) in ColorTheme.xlsm >> // Dimension.

If a dimension has a high cardinality of values it is probably not interested to have a distinct color for each value and it is convenient to use the default colors.

0 Likes
Version history
Revision #:
1 of 1
Last update:
‎2018-04-20 11:36 AM
Updated by: