We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add 3-D Stacked Column chart in presentation

Platform: WinForms |
Control: Presentation |
Published Date: February 26, 2016 |
Last Revised Date: June 23, 2021

 

Essential Presentation provides support to create and modify 3D Column Stacked Charts. The below assemblies are needed to execute the code explained below,

  1. Syncfuison.Presentation.Base
  2. Syncfusion.OfficeChart.Base
  3. Syncfusion.Compression.Base

The below code example illustrates creating a PowerPoint presentation and adding a blank slide.

//Create presentation with empty slides.
IPresentation presentation = Presentation.Create();
//Add blank slide into the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);

 

 

 

 

The below code example illustrates creating a chart and adding the related chart data.

//Add chart to the slide with specified size and positions.
IPresentationChart chart = slide.Shapes.AddChart(100, 100, 640, 427);
//Sets value to the chart's worksheet.
chart.ChartData.SetValue(2, 1, "Category 1");
chart.ChartData.SetValue(3, 1, "Category 2");
chart.ChartData.SetValue(4, 1, "Category 3");
chart.ChartData.SetValue(5, 1, "Category 4");
chart.ChartData.SetValue(1, 2, "Series 1");
chart.ChartData.SetValue(2, 2, 4.3);
chart.ChartData.SetValue(3, 2, 2.5);
chart.ChartData.SetValue(4, 2, 3.5);
chart.ChartData.SetValue(5, 2, 4.5);

 

 

 

 

 

 

 

 

 

 

 

 

 

//Set chart type as Column_Stacked_3D.
chart.ChartType = OfficeChartType.Column_Stacked_3D;

The below code example illustrates setting the chart type.

 

 

 

The below code example illustrates adding a serie to the chart and setting the serie range.

//Add first serie to chart series collection with specified serie name.
IOfficeChartSerie serie1 = chart.Series.Add("Series 1");
//Sets values to first serie.
serie1.Values = chart.ChartData[2, 2, 5, 2];

 

 

 

 

 

The below code example illustrates adding category label values from chart data.

//Sets values to category labels of primary category axis.
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 5, 1];

 

 

 

The below code example illustrates setting rotation and elevation for the 3D chart.

//Set RotationY value.
chart.Rotation = 20;
//Sets RotationX value.
chart.Elevation = 15;

 

 

 

 

 

The below code example illustrates saving the created presentation to a file.

//Saves the presentation with specified file name with extension.
presentation.Save("3DColumnStackedChart.pptx");

 

You can find the complete sample here.

 

 

 

 

 

 

 

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile