Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Mon Oct 25, 2021 5:42 am

Hi Team

Please let me know how to create tree map chart for attached sample image.

Thanks in advance

pr20080798
 
Posts: 146
Joined: Wed Jan 20, 2021 1:15 pm

Mon Oct 25, 2021 7:41 am

Hello,

Thanks for your message.
The Tree map chart is a new feature in PowerPoint 2016, sorry at present our Spire.Presentation doesn't support it. We have added it into our upgrade list. Once it is done in the future, we will let you know at the first time. Thanks for your understanding.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Jan 21, 2022 9:27 am

Hello,

Glad to inform that we just released Spire.Presentation Version:7.1 which supports creating "TreeMap" chart now, please download it and refer to the following sample code to test.
Code: Select all
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);

Website link(MSI Version):https://www.e-iceblue.com/Download/download-presentation-for-net-now.html
Nuget link:https://www.nuget.org/packages/Spire.Presentation/7.1.0

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Jan 25, 2022 7:14 am

Hello,

Greetings from E-iceblue.
Did the new feature work for you? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Presentation