Articles in this section
Category / Section

How to add 3-D 100% Stacked Column Chart in .NET WebForms Presentation?

1 min read

 

Essential Presentation provides support to create and modify 3D 100% Stacked Column 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_100-3D.
chart.ChartType = OfficeChartType.Column_Stacked_100_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("3D100%ColumnStackedChart.pptx");

 

You can find the complete sample here.

 

Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied