Hierarchical Tables Zoo
Hierarchical Tables are one of the many types of tabular visualization in the DataFrame Zoo. Zooming in, Hierarchical tables themselves have their own zoo that will be explored here.
Hierarchy in a single column
By default all the columns used in creating the hierarchical groupings is displayed in a compact format in a single column.
Non-aggregate hierarchies
Any raw data can be instantly visualized hierarchically by picking a few fields to represent the levels of the hierarchy. For example, the orders data is rendered below by grouping the data first by Region and then by Sales Channel.
hdf.hideRoot = true;
can be used to hide the root node as shown below. When hideRoot
is not explicitly specified, SQL Frames
automatically decides whether or not to show the root node.
Aggregate hierarchies
A grouped DataFrame (gdf
) can be organized as a hierarchy. When rollup
operator is used for aggregation,
the intermediat rows of the hierarchy contains the sub and grand-totals.
Pivot table hierarchies
Pivot table rows can also be organized as a hierarchy.
Hierarchy in separate columns
Sometimes combining the hierarchical fields into one single column may not make functional sense
or the end users are already used to seeing it in separate columns. Hence it is possible to display
them as separate columns as shown below using hdf.singleHierarchyField
API.
End users can toggle to compact display mode of the hierarchy column using View -> Single/Separate Hierarchy Column(s)
It is also possible to display the hierarchy in separate columns but sub-hierarchies within the same column. This is achieved using Dimension Hierarchies.
Non-aggregate hierarchies
Aggregate hierarchies
Pivot table hierarchies
Recursive Hierarchy
All the above mentioned hierarchies have fixed levels. There are self-recursive relationships in enterprise applications such as manager-employee, bills-of-material or product category hierarchy. SQL Frames not only supports SQL queries on such self-recursive data using the WITH RECURSIVE clause, it also provides corresponding recursive data visualization using the Hierarchical DataFrame.
Recursive hierarchy fields can only be displayed in a single column.
hdf.hierarchyName = 'Geo'
can be used to set the display name of the Hierarchy Field to change the default value of Hierarchy.