Configuring Images as Points
Most of the functionality in QlikMaps is accessible through simple selections from drop-down menus. See Points - Marker Type - Image for more information.
If an older versions of QlikMaps is used or there is a need for more granular control over the map, more advanced techniques can be used.
Below are a number of examples of advanced expressions that can be used to customize 'Image' maps.
Image Opacity
By default, image opacity is set to 85%. This can be changed using an expression for image opacity.
To configure different opacity levels for images, click on the color caption and select the gear icons.
Single Opacity Level Images
- Open the opacity expression box by clicking on the Fx.
- Type a number between 0 and 100 in the expression editor that corresponds to the desired opacity percentage.
- Enclose the color value in single quotes.
'50'
Multi Opacity Level Images
- Open the opacity expression box by clicking on the Fx.
- Type an an expression that returns a number between 0 and 100 that corresponds to the desired opacity percentage for each icon type in the expression editor.
- Enclose the expression in single quotes.
'if(Sum([x]) > sum(TOTAL [x])/Count(DISTINCT Total [Dimension]), 100,50)'
Or
'if([Dimension]=''A'',100,50)'
Note that in the example above two single quotes are used around the value A
. This is because two single quotes are necessary when returning a Text value. For more information, see Qlik Sense Editor
Image Size
By default, icon size is set to the size of the icons. That size can be changed using an expression.
To configure a different marker size select <Use Expression>
.
- If
value
is selected, the expression will take the return of any Sense expression and scale the points accordingly. - If
pixels
is selected, the expression must return the pixel size for each point. The examples below provide examples.
Single Marker Size for all Markers
- Open the size expression box by clicking on the Fx.
- Type a number in the expression editor that corresponds to the desired pixel size for Icons.
- Enclose the color value in single quotes.
'50'
Multi Marker Size for Markers
- Open the size expression box by clicking on the Fx.
- Type an an expression that returns a number that corresponds to the desired pixel size for each marker type in the expression editor.
- Enclose the expression in single quotes.
Often, normal expression such as Sum( Sales )
returns a large number that is not suitable as a pixel size. We recommend in most scenarios to use a scaling function such as the one below. The scaling function compares the value of a each point compared to the value of all other points and sets a pixel size for all icons between 5 and 30.
'( sum([x]) / (max(TOTAL aggr(sum([x]),[Dimension]))) * 25 ) + 5'
Or
Min - Max scaling expression
'( ( Sum([x]) - Min(TOTAL Aggr(Sum([x]), [Dimension])) ) / ( Max(TOTAL Aggr(Sum([x]), [Dimension])) - Min(TOTAL Aggr(Sum([x]), [Dimension]))) * 25 ) + 5'
Marker Image
- Open the marker image expression box by clicking on the Fx.
- Type the location of a .png, .gif, or .jpg using the absolute path or relative path to the
/img
directory of the QlikMaps install directory - Enclose the expression in single quotes.
- Click apply
- Remove the equal sign
Sense adds the equal sign every time the expression editor is opened. This means that after each edit of the marker image expression box, the equal sign must be removed.
Some images are pre-packaged with Qlik Sense under the 'img' directory of the the Sense install directory and can be called by simply typing in the name of the icon.
'hotel.png'
Other images can be use as long as the client machine displaying the map can reach the file.
'https://cdn2.iconfinder.com/data/icons/flat-ui-icons-24-px/24/location-24-128.png'