A chart communicates data graphically on a slide. The Syncfusion .NET PowerPoint Library allows you to create, remove, and customize 80+ types of charts in PowerPoint presentations using C#, without Microsoft PowerPoint or interop dependencies.
Here is an example of how to create a pie chart in a PowerPoint presentation in C# using the Syncfusion .NET PowerPoint Library.
//Create an instance of presentation.
using IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a chart to the slide with position and size.
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Select the chart type.
chart.ChartType = OfficeChartType.Pie;
//Assign data range.
chart.DataRange = chart.ChartData[1, 1, 6, 2];
chart.IsSeriesInRows = false;
//Set the values for the chart data.
chart.ChartData.SetValue(1, 1, "Food");
chart.ChartData.SetValue(2, 1, "Fruits");
chart.ChartData.SetValue(3, 1, "Vegetables");
chart.ChartData.SetValue(4, 1, "Dairy");
chart.ChartData.SetValue(5, 1, "Protein");
chart.ChartData.SetValue(6, 1, "Grains");
chart.ChartData.SetValue(1, 2, "Percentage");
chart.ChartData.SetValue(2, 2, 36);
chart.ChartData.SetValue(3, 2, 14);
chart.ChartData.SetValue(4, 2, 13);
chart.ChartData.SetValue(5, 2, 28);
chart.ChartData.SetValue(6, 2, 9);
//Set data labels.
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
//Save the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create, FileAccess.ReadWrite);
presentation.Save(outputStream);
A chart consists of various elements, such as title, area, plot area, series, legends, data labels, and axes. The .NET PowerPoint Library allows you to format each element, enhancing the visual appeal of the charts in a PowerPoint.
Modify the chart title by changing its name, appearance, resizing the title area, and more.
Enhance the chart area and plot area by adjusting borders, colors, transparency, adding images, changing positions, and more.
Customize the chart series by adjusting the series name, type, color, borders, adding space between bars, formatting markers, and more.
Customize the chart legend by modifying the position, border, and legend entries.
Adjust the chart data labels by changing their positions, sizes, and more.
Customize the horizontal and vertical axes of a chart by modifying the title, border, font, rotation angle, and more.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.