Tuesday, 7 July 2026

How to Create Tree Charts in Apache Superset

  

A Tree Chart is a visualization used to display hierarchical data in a parent-child structure. It helps to show how different items are connected and organized across multiple levels.

 

It starts with a root node at the top (or center), and branches out into child nodes, similar to the structure of a real tree. Tree charts are commonly used when one item is related to another item in a hierarchy.

 

org_hierarchy.csv

employee_id,employee_name,designation,department,manager_id,location,salary
1,Arjun Mehta,CTO,Technology,,Bangalore,4500000
2,Priya Sharma,Executive Director Engineering,Engineering,1,Bangalore,3200000
3,Rahul Verma,Executive Director Data,Data Platform,1,Hyderabad,3100000
4,Neha Kapoor,Executive Director Infrastructure,Infrastructure,1,Pune,3000000
5,Vikram Rao,Senior Engineering Manager,Engineering,2,Bangalore,2200000
6,Sneha Iyer,Engineering Manager,Engineering,5,Bangalore,1800000
7,Amit Joshi,Engineering Manager,Engineering,5,Chennai,1750000
8,Karan Patel,QA Manager,Quality Assurance,5,Chennai,1700000
9,Divya Nair,Senior Data Manager,Data Platform,3,Hyderabad,2100000
10,Ankit Singh,Data Engineering Manager,Data Platform,9,Hyderabad,1800000
11,Meera Reddy,Analytics Manager,Analytics,9,Hyderabad,1750000
12,Rohit Kulkarni,Infrastructure Manager,Infrastructure,4,Pune,1900000
13,Pooja Menon,Cloud Operations Manager,Infrastructure,12,Pune,1750000
14,Sanjay Das,Security Manager,Infrastructure,12,Bangalore,1800000
15,Rakesh Kumar,Senior Software Engineer,Engineering,6,Bangalore,1400000
16,Anjali Gupta,Software Engineer,Engineering,6,Bangalore,1100000
17,Varun Malhotra,Software Engineer,Engineering,6,Bangalore,1050000
18,Nikita Jain,Frontend Engineer,Engineering,7,Chennai,1150000
19,Harsha Vardhan,Backend Engineer,Engineering,7,Chennai,1200000
20,Deepika Rao,Automation Engineer,Quality Assurance,8,Chennai,1000000
21,Suresh Babu,QA Engineer,Quality Assurance,8,Chennai,950000
22,Kavya Srinivas,Data Engineer,Data Platform,10,Hyderabad,1250000
23,Manoj Tiwari,Big Data Engineer,Data Platform,10,Hyderabad,1300000
24,Ritika Sen,BI Analyst,Analytics,11,Hyderabad,950000
25,Akash Yadav,Data Analyst,Analytics,11,Hyderabad,900000
26,Farhan Ali,Cloud Engineer,Infrastructure,13,Pune,1150000
27,Shalini Roy,DevOps Engineer,Infrastructure,13,Pune,1200000
28,Yash Chopra,System Administrator,Infrastructure,13,Pune,850000
29,Tanvi Kulkarni,Security Analyst,Infrastructure,14,Bangalore,1100000
30,Abhishek Nair,Cyber Security Engineer,Infrastructure,14,Bangalore,1250000
31,Ritu Sharma,Junior Software Engineer,Engineering,15,Bangalore,800000
32,Ajay Kumar,Junior Software Engineer,Engineering,15,Bangalore,780000
33,Shruti Menon,UI Developer,Engineering,18,Chennai,850000
34,Naveen Raj,API Developer,Engineering,19,Chennai,900000
35,Komal Arora,Test Engineer,Quality Assurance,20,Chennai,750000
36,Pradeep Shetty,Junior Data Engineer,Data Platform,22,Hyderabad,820000
37,Ishita Bose,Reporting Analyst,Analytics,24,Hyderabad,700000
38,Arvind Iyer,Cloud Support Engineer,Infrastructure,26,Pune,780000
39,Pallavi Desai,DevOps Associate,Infrastructure,27,Pune,760000
40,Kunal Agarwal,Security Associate,Infrastructure,29,Bangalore,740000

   

Let’s take above organizational data to build the Tree Chart. Each row represents one employee in the organization, and the relationships between employees are created using the manager_id column.

 

Following table summarizes the above csv data.

 

Column Name

Description

employee_id

A unique identifier for each employee. This value is used as the node ID in the tree chart.

employee_name

The full name of the employee. This is displayed as the label on the tree chart nodes.

designation

The employee's job title or role in the organization, such as CTO, Manager, or Software Engineer.

department

The department where the employee works, such as Engineering, Infrastructure, Analytics, or Data Platform.

manager_id

The employee ID of the person's manager. This creates the parent-child relationship required for hierarchical visualization.

location

The office location or city where the employee works.

salary

The annual salary of the employee. This can also be used for analysis, filtering, or additional charting.  

 

Follow below step-by-step procedure to build the tree chart.

 

Step 1: Create org_hierarchy dataset.

 

Data -> Upload CSV to database

 


Upload the csv file.

Choose the database and schema where you want to upload the csv file.

Give the table name as org_hierarchy_demo.

 


Expand Columns section.

 

·      Select all the columns

·      Set Column data types to {"employee_id": "int32", "employee_name": "string", "designation" : "string", "department" : "string", "manager_id" : "int32", "location" : "string", "salary" : "float32"}

 

Click on Upload button to create the dataset.

 

Navigate to datasets listing page, you can able to see the org_hierarchy dataset.

 

Step 2: Create tree chart.

 

Click on org_hierarchy dataset.

 

It takes you to the chart configuration page.

 


Click on ‘View all charts’ link.

 

Select tree chart.

 


Drag and drop employee_id column to Id, manager_id column to Parent, employee_name to Name, 1 to Root node id fields.

 


Click on Create chart button, you can able to see tree chart like below.

 


Apache Superset tree charts often default to expanding only 3 levels, requiring manual interaction to expand further.

 

Click on any child node, you can observer it auto expands.  

 


Navigate to Customize tab and start experimenting with all the option to get comfortable.

 

That’s it, you're good to go.

 

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment