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 visuals.

  1. Open the visual World Population - Dual Bar and Line in Edit mode. For information on building this visual.
  2. Clone the visual.
  3. Click the Pencil icon next to the title of the visualization to edit it, and enter the new name.
  4. Optional: Click the Pencil icon below the title of the visualization to add a brief description of the visual.
  5. Change the title to World Population - Highlights on Dual Bar and Line.
  6. At the top left corner of the Visual Designer, click Save.
  7. Add the un_region field to the Filters shelf, and select Europe from the list of possible values.

    This graph has more variation than the unified World data.

  8. Click Refresh Visual.

    You can see the pronounced peak in the GDP per Capita line, centered around the year 2005.

  9. Based on the graph, highlight the values where GDP per Capita is over $25,000.
  10. Place the field gdp_per_capita on the shelf Highlight Mark Measure.
  11. On the same shelf, click the Down arrow icon on the gdp_per_capita field, and choose Enter/Edit Expression.
  12. In the Enter/Edit Expression window modal, delete the text in the default expression, change the function groupings to Conditional, and select the if statement.
  13. 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'
  14. Click Save.
  15. Save the visual, and then click View to change to View mode.
  16. 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.