Hi Team
Please let me know how to create tree map chart for attached sample image.
Thanks in advance
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.TreeMap, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 3].Text = "Series 1";
string[,] categories = {{"Branch 1","Stem 1","Leaf 1"},{"Branch 1","Stem 1","Leaf 2"},{"Branch 1","Stem 1", "Leaf 3"},
{"Branch 1","Stem 2","Leaf 4"},{"Branch 1","Stem 2","Leaf 5"},{"Branch 1","Stem 2","Leaf 6"},{"Branch 1","Stem 2","Leaf 7"},
{"Branch 2","Stem 3","Leaf 8"},{"Branch 2","Stem 3","Leaf 9"},{"Branch 2","Stem 4","Leaf 10"},{"Branch 2","Stem 4","Leaf 11"},
{"Branch 2","Stem 5","Leaf 12"},{"Branch 3","Stem 5","Leaf 13"},{"Branch 3","Stem 6","Leaf 14"},{"Branch 3","Stem 6","Leaf 15"}};
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 3; j++)
chart.ChartData[i + 1, j].Text = categories[i, j];
}
double[] values = { 17, 23, 48, 22, 76, 54, 77, 26, 44, 63, 10, 15, 48, 15, 51 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 3].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 3, 0, 3];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, values.Length, 2];
chart.Series[0].Values = chart.ChartData[1, 3, values.Length, 3];
chart.Series[0].DataLabels.CategoryNameVisible = true;
chart.Series[0].TreeMapLabelOption = TreeMapLabelOption.Banner;
chart.ChartTitle.TextProperties.Text = "TreeMap";
chart.HasLegend = true;
chart.ChartLegend.Position = ChartLegendPositionType.Top;
ppt.SaveToFile(outputFile, FileFormat.PPT);