Using a Tree Diagram
The Tree diagram displays information about the hierarchical structure of the data. Displayed like a tree, this relationship diagram is often used to display organizational charts and other family descent structures.
This article provides an example of a tree diagram that uses two types of data:
- A multi-level hierarchy showing countries and territories, which can then be drilled up or down between the levels.
- A list of names that will be joined and presented as an additional level in the diagram
2. Data preparation
To follow the examples in this article, create the following data cube from the Adventure Works database using the [Sales].[SalesPerson], [Sales].[SalesTerritory], and [Person].[Person] tables.
To illustrate the hierarchical relationships, use the following custom data to create a hierarchy and apply it to TerritoryID.
To illustrate the ability to display images in nodes, place a folder with images in a location accessible for the Dundas BI application. The folder in this example is located inside the instance folder:
3. Add a Tree diagram
While in the dashboard designer, use the Data Visualization option from the toolbar and select Tree Diagram.
Drag the TerritoryID dimension from the data cube in the Explore panel to the Rows (nodes) field.
Drag the FirstName dimension from the data cube to the Rows (nodes) field.
The diagram is displayed in a horizontal tree-like arrangement based on the order of the hierarchies.
Switch to View mode. Right-click the United States of America node and select Expand.
4. Change node color and size
Switch back to Edit mode.
Open the Visualization tab of the Data Analysis Panel.
Drag the SalesLastYear measure from the data cube to the Color field.
An Auto Color Rule is applied to the nodes in the diagram. You can modify the settings of the rule by clicking the brush icon next to the Color field, or going to the Look section of the Properties panel and selecting Auto Color Rule.
Drag the SalesYTD measure from the data cube to the Size field.
Auto Size Rules are applied to the nodes in the diagram. You can modify the settings of the Size Rules in the same manner as modifying the color rule. For example, click the brush icon to the right of the Size field and change the Distribution to Equal Distribution.
4.1. Display images in nodes
To use the images in our pics folder as background for the Tree diagram nodes, open the Look properties.
Type the following into the Image Path field:
The member placeholder will use the member name of each node to retrieve the relevant image.
5. Change link color and width
Expand the Links section of the Data Analysis Panel and drag the SalesLastYear measure to the Color field.
An Auto Color Rule is applied to the links in the diagram. You can modify the settings of the rule by clicking the brush icon next to the Color field, or going to the Look section of the Properties panel and selecting Auto Color Rule. For example, click the brush icon to the right of the field and change the Distribution to Equal Distribution and adjust the colors.
Drag the SalesYTD measure to the Width field.
The width of each link is now defined by its fraction of the total.
6. Change labels and tooltips
Under the Text section of the Properties panel, you can customize the Label Text and Tooltip Text properties for both the links and the nodes.
These properties accept regular text, as well as keywords such as [Member] and [Level] for the hierarchy member and level caption respectively. For additional information about available keywords, refer to the Formatting Text article.
As a shortcut for applying the proper keyword, you can use the Visualization tab in the Data Analysis Panel.
For example, drag the SalesYTD measure to the Links Label field.
Click the brush image next to the Label field to open the relevant properties section. The keyword [SalesYTD] has already been added to the Text field. Change the keyword to [SalesYTD:N0] to remove the decimal points.
7. Tree Orientation
The tree orientation can go either from left to right (horizontal) or from top to bottom (vertical). To change the orientation, open the Layout properties and select your choice from the Tree Orientation drop-down.