Create a Treemap in Excel using C#

Follow this article to create a Treemap in Excel using C#. It has details to set the IDE, a list of steps, and a sample code to work with the Excel Treemap chart in C#. You will learn all the details to create sample data, create a chart, and set its parameters.

Steps to Create a Tree Map using C#

  1. Set the environment to use Aspose.Cells for .NET to create a Treemap
  2. Create a workbook and add sample hierarchy data in a sheet
  3. Optionally, make the data presentation pretty by setting a border
  4. Create a Treemap chart using the ChartType enumerator
  5. Set chart title, values, categories, and flag to display multi-level labels
  6. Set flags to show values in the rectangles and category name in the Treemap
  7. Set legend position and save the resultant workbook as an XLSX file

These steps explain the creation of Tree map chart in Excel with C#. Set the environment, create a Workbook object, enter sample data, and create a Treemap chart in the target sheet. Set the chart parameters, flags to display values in the Treemap rectangle, category name, and set the legend before saving the output Excel file.

Code to Create Tree Map in Excel using C#

This code can be used for working with the Excel Tree map chart. You can use the ChartType enumerator to create various types of charts, including Area3D, Bar, Column, Cone, Cylinder, Doughnut, Line, and Pie, among others. Various other parameters can be set to customize the chart visualization using the Chart class.

This article has described the process to handle the Treemap. To create a Sunburst chart, refer to the article on Create a Sunburst Chart in Excel using C#.