DoughnutSeries Class
A series that displays data points as segments of a doughnut.
Namespace: DevExpress.Docs.Office
Assembly: DevExpress.Docs.Core.v26.1.dll
NuGet Package: DevExpress.Docs.Core
Declaration
Example
The following code snippet creates a doughnut chart, populates it with data, and adds it to a slide:
using DevExpress.Docs.Office;
using DevExpress.Docs.Presentation;
namespace PresentationApiSample;
public class Program {
public static async Task Main(string[] _) {
// Create a presentation.
Presentation presentation = new Presentation();
// Reset the slide collection.
presentation.Slides.Clear();
// Add a blank slide.
Slide slide = new Slide(SlideLayoutType.Blank);
presentation.Slides.Add(slide);
// Insert a chart on the slide.
Chart chart = new Chart();
slide.Shapes.Add(chart);
// Set chart size to match the slide.
chart.Width = presentation.SlideSize.Width;
chart.Height = presentation.SlideSize.Height;
// Populate series argument data.
chart.Data[0, "A1"].TextValue = "Category A";
chart.Data[0, "A2"].TextValue = "Category B";
chart.Data[0, "A3"].TextValue = "Category C";
chart.Data[0, "A4"].TextValue = "Category D";
chart.Data[0, "A5"].TextValue = "Category E";
// Populate series value data.
chart.Data[0, "B1"].NumericValue = 29;
chart.Data[0, "B2"].NumericValue = 31;
chart.Data[0, "B3"].NumericValue = 27;
chart.Data[0, "B4"].NumericValue = 19;
chart.Data[0, "B5"].NumericValue = 15;
// Create a doughnut series and bind it to worksheet ranges.
DoughnutSeries series = new DoughnutSeries();
series.Arguments = new ChartDataReference("A1", "A5");
series.Values = new ChartDataReference("B1", "B5");
chart.Series.Add(series);
// Configure series appearance and data labels.
series.Explosion = 0.15f;
series.DataLabels.ShowValue = true;
// Access and configure the doughnut chart view.
DoughnutChartView view = chart.Views[0] as DoughnutChartView;
view.VaryColors = true;
view.HoleSize = 30;
// Save the result to a file.
var outputPath = @"D:\presentation.pptx";
using FileStream outputStream = new(outputPath, FileMode.Create, FileAccess.Write, FileShare.None);
presentation.SaveDocument(outputStream);
}
}
Implements
Inheritance
Object
OfficeObject
SeriesBase
PieSeriesBase
DoughnutSeries
See Also