With limited real estate, showing legend for each chart may not be a good idea, especially if you are trying to increase the data-ink.
Data-ink was a term coined by Dr. Edward Tufte. The idea is to increase the number of pixels that tell the data stories effectively.
One of the issues user face — in Qlik Sense — without a legend is to identify dimension value associated with a bar or a line in a chart.
Enter Silent Legend.
Think of a silent legend as a legend object simply to show a dimension value and its associative color.
How It Works
First, create a variable using combination of FieldIndex() and Color() functions.
I wanted to show county for various COVID-19 charts using data from the Georgia department of health.
Let’s create a variable that stores an expression for the silent legend.
Let’s understand these functions.
FieldIndex() returns the position of the field value value in the field field_name (by load order). — Qlik Sense Help
fieldindex() function will fetch the position of the field value as it is being loaded into the data model.
Since the field name is the first parameter and it is a string value, the syntax requirement is to have it enclosed in a pair of single quotes.
Color() is used in expressions to return the color representation of color number n in the chart palette shown in the chart properties. The color representation is a dual value where the text representation comes in the form of ‘RGB(r, g, b)’ where r, g and b are numbers between 0 and 255 representing the red, green and blue color value respectively. The number representation is an integer representing the red, green and blue components. — Qlik Sense Help
The field position is used by the color function to return a unique color for each field value.
Now, we can use this expression to not only create the silent legend but also to create color consistency across various charts that use county as a dimension.
I first created a silent legend using a table object with a background color expression for the County dimension.
Once the silent legend shows color for each county, I can apply the same color expression to multiple charts using dollar-sign expansion to show consistent colors across numerous charts.
The treemap chart, pie chart, bar chart, and the area layer showing county are all displaying consistent color for each county.
With this, uses can easily reference the silent legend to gain insight for each county quickly.