[]
Treemap charts are used to display hierarchical data as a set of nested rectangles. This type of charts is used to represent hierarchical data in a tree-like structure. Use this chart when data is organized hierarchically and has fewer categories.
Sample Image | Description |
---|---|
ChartType.Treemap Represents a treemap chart. It is used to display large amount of hierarchical data without any space constraints. |
Refer to the following example code to add a treemap chart.
C#
// Treemap chart.
object[,] dataArray = {
{ "Region", "Subregion", "Country", "Population"},
{ "Asia", "Southern", "India", 9541854},
{"","" , "Pakistan", 2003818},
{"","" , "Thailand", 4668149},
{"","" , "Others", 1700300},
{"", "Eastern", "China", 15045928},
{"","" , "Japan", 5271852},
{"","" , "Others", 1912273},
{"", "South-Eastern","" , 9536576},
{"", "Western", "", 2722989},
{"", "Central","" , 7186065},
{ "Africa", "Eastern","" , 3043132},
{"", "Western","" , 3819688},
{"", "Northern","" , 2784677},
{"", "Others","" , 2512021},
{ "Europe","" ,"" , 7448010},
{ "Others","" ,"" , 10117703}
};
for (int i = 0; i < dataArray.GetLength(0); i++)
{
for (int j = 0; j < dataArray.GetLength(1); j++)
{
spreadSheet1.Workbook.ActiveSheet.Cells[i, j].Value = dataArray[i, j];
}
}
spreadSheet1.Workbook.ActiveSheet.Cells["A1:D17"].Select();
spreadSheet1.Workbook.ActiveSheet.Shapes.AddChart(GrapeCity.Spreadsheet.Charts.ChartType.Treemap, 100, 150, 400, 300, false);
spreadSheet1.Workbook.ActiveSheet.ChartObjects[0].Chart.ChartTitle.Text = "Treemap chart";
VB
' Treemap chart.
Dim dataArray = {
{"Region", "Subregion", "Country", "Population"},
{"Asia", "Southern", "India", 9541854},
{"", "", "Pakistan", 2003818},
{"", "", "Thailand", 4668149},
{"", "", "Others", 1700300},
{"", "Eastern", "China", 15045928},
{"", "", "Japan", 5271852},
{"", "", "Others", 1912273},
{"", "South-Eastern", "", 9536576},
{"", "Western", "", 2722989},
{"", "Central", "", 7186065},
{"Africa", "Eastern", "", 3043132},
{"", "Western", "", 3819688},
{"", "Northern", "", 2784677},
{"", "Others", "", 2512021},
{"Europe", "", "", 7448010},
{"Others", "", "", 10117703}}
For i = 0 To dataArray.GetLength(0) - 1
For j = 0 To dataArray.GetLength(1) - 1
spreadSheet1.Workbook.ActiveSheet.Cells(i, j).Value = dataArray(i, j)
Next
Next
spreadSheet1.Workbook.ActiveSheet.Cells("A1:D17").[Select](gcdocsite__documentlink?toc-item-id=013f1b3f-c070-40d5-b4b4-e3e7bf016abe)
spreadSheet1.Workbook.ActiveSheet.Shapes.AddChart(GrapeCity.Spreadsheet.Charts.ChartType.Treemap, 100, 150, 400, 300, False)
spreadSheet1.Workbook.ActiveSheet.ChartObjects(0).Chart.ChartTitle.Text = "Treemap chart"