
Working with natural hierarchies in data
Data often contains natural hierarchies. One immediate example is date/time information. The highest (or least granular) level might be year. Then comes month, then day, hour, minute, and so on. There are also natural hierarchies in other types of data. In the example we are working with in this chapter, Region, Sub-Region, and Country form a natural hierarchy in the data. We can use this natural hierarchy to change the way we view the data, with Spotfire automatically being able to group or aggregate the data at any level within the hierarchy.
Hierarchies can be configured as columns in the data or by adding multiple columns to an axis selector. I'll show the former in the Analyst client and the latter in the web client.
Add a hierarchy as a column (for Analyst clients only):
- From the Data menu, choose Add hierarchy....
- From the Available columns selector, choose the following options (in the following order):
- region
- sub-region
- Entity
- Give the new hierarchy a name. I often choose something that really tells the user exactly what the hierarchy represents. In this case, I recommend Region-Sub Region-Country:

- Click OK.
- From the Marker by dropdown in the legend, choose the hierarchy you created in the last step:

To create a hierarchy (all clients) using an axis selector, follow these steps:
- Remove Entity from the Marker by selector (right-click and select Remove all).
- Now, choose region for Marker by.
- Then, add sub-region by clicking the + icon:

- Choose sub-region.
- Repeat this for Entity.
- Finally, create a hierarchy by right-clicking on the axis selector and choosing Create hierarchy:

We'll be experimenting with navigating the hierarchy in the next section, Gaining insight from the scatter plot.
Before we finish with this section, there are a few recommended settings that I suggest we apply for best-practice purposes.
If you're using an Analyst client, you can set the minima and maxima for the axes showing gridlines and add a horizontal line at the origin of the y-axis), as follows:
- Right-click on the visualization and select Properties.
- Select the X-axis property page and set the following options:
- Range Min—0.00; Max—18.00
- Show gridlines:

- Select the Y-axis property page and set the following options:
- Range Min—-2.00; Max—4.50
- Show gridlines:

- Select the Lines & Curves property page and set the following option:
- Horizontal line: 0.00:

- Close the Properties dialog.
Finally, we should set the number formatting for the Total population column. This can be done in either the Analyst or web clients:
- Expand the data panel and right-click on the column. If you're using an Analyst client, choose Column properties, then Formatting. If you are using a web client, choose Formatting....
- Then, set the formatting to the short number format and 1 decimal. Here is the dialog from a web client for illustration (Analyst clients have similar options):

Notice that as you update the settings for a visualization, the changes happen immediately. The Properties dialog is not modal—this means that you can still interact with your Spotfire analysis as you adjust the properties.
The visualization should now look something like this (Analyst clients):
