Dimension hierarchies enable you to create complete visualizations with powerful drill down capability within a single visual, instead of relying on a complex interaction of two or more visuals inside an app.
Dimension hierarchies can be used with bar, line, area, and grouped bar visual types.
We also provide an alternate solution for hierarchical dimension representation in cross tabulation visuals.
The following steps demonstrate how to use Region
, a dimensional hierarchy based on dataset World Life Expectancy
[data source samples.world_life_expectancy
], to build a bar chart that can switch between representations at three different levels of data granularity. To create this hierarchy, see Creating New Dimension Hierarchies.
Start a new bar visual on the World Life Expectancy dataset.
See Bar Visuals.
In the Visual Designer interface, populate the shelves of the visual:
Region
(which is a dimensional hierarchy), and drag it onto the X Axis
shelf.population
and drag it
onto the Y Axis shelf.Click Refresh Visual.
The bar chart appears.
Note that the legend along the X axis corresponds to the top level of theRegion
hierarchy, un_region
.Change the title to World Population - Hierarchy
.
At the top left corner of the Visual Designer, click Save.
Click Close to switch to View mode, so you can examine the operation of the dimensional hierarchy in the visual.
Put the pointer over one of the data labels along the horizontal axis, and note that it changes color; this is because the data labels are link-enabled. Click on one of the choices to drill down to a lower level of the hierarchy.
In the following graphic, we drilled down from Level 1: un_region =
'Americas'
, to Level 2: un_subregion = 'South America'
,
and then to Level 3: country
.
Note that every time you move between the hierarchy levels, the scale of the vertical axis adjusts automatically.
Similarly, put the pointer over the label of the horizontal axis, and note that it change color; it is also link-enabled. Click the horizontal axis label to go up the hierarchy levels.
In the following graphic, we moved from Level 3: country
where
un_region = 'America'
and un_subregion = 'South
America'
to Level 2: un_subregion = 'South America'
where un_region = 'America'
, and then to Level 1:
un_region
.