Adding highlights to visuals
Highlights are a practical way to bring attention to values that exceed a particular threshold. CDP Data Visualization currently supports highlight marks at specific values on the combined bar/line chart type, and enables you to customize these highlights.
The following steps demonstrate how add highlights to an existing chart. To start, we are
using the visual
World Population - Dual Bar and Line, developed on dataset
World Life Expectancy [data source
samples.world_life_expectancy]. For more information, see Combo
Open the visual
World Population - Dual Bar and Linein Edit mode. For information on building this visual.
Clone the visual.
- Click the Pencil icon next to the title of the visualization to edit it, and enter the new name.
- Optional: Click the Pencil icon below the title of the visualization to add a brief description of the visual.
Change the title to
World Population - Highlights on Dual Bar and Line.
- At the top left corner of the Visual Designer, click Save.
un_regionfield to the Filters shelf, and select
Europefrom the list of possible values.
This graph has more variation than the unified World data.
Click Refresh Visual.
You can see the pronounced peak in the GDP per Capita line, centered around the year 2005.
- Based on the graph, highlight the values where GDP per Capita is over $25,000.
Place the field
gdp_per_capitaon the shelf Highlight Mark Measure.
On the same shelf, click the Down arrow icon on the
gdp_per_capitafield, and choose Enter/Edit Expression.
In the Enter/Edit Expression window modal, delete the text in
the default expression, change the function groupings to
Conditional, and select the if
Complete the expression template.
It should look similar to the following expression:
if(avg([gdp_per_capita])>=25000, avg([gdp_per_capita]), null)
Optionally, you can alias the highlight; see the bold font in the changed expression.
if(avg([gdp_per_capita])>=25000, avg([gdp_per_capita]), null) as 'GDP per Capita > 25K'
Save the visual, and then click View to change to
- Optional: The default highlight mark is a circle. To convert it to another type, use the visual Settings interface, as described in Change highlight type. You can also change the relative size of the mark, as described in Change highlight type.