Skip to main content
All docs
V26.1
  • ChartOfPieView Class

    A view that displays Pie-of-Pie or Bar-of-Pie charts.

    Namespace: DevExpress.Docs.Office

    Assembly: DevExpress.Docs.Core.v26.1.dll

    NuGet Package: DevExpress.Docs.Core

    Declaration

    public class ChartOfPieView :
        ColorfulChartView

    Remarks

    For additional information about series and views, refer to the following help topic: Series and Views.

    The following code snippet adds a Bar-of-Pie chart to a presentation:

    DevExpress Presentation API - Bar-of-Pie Chart

    using DevExpress.Docs.Office;
    using DevExpress.Docs.Presentation;
    using System.Drawing;
    
    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;
    
            // Create a series for a Pie-of-Pie or Bar-of-Pie chart.
            ChartOfPieSeries series = new ChartOfPieSeries();
    
            // Specify category labels and values.
            series.Arguments = new ChartStringData(new string[] { "A", "B", "C", "D", "E", "F" });
            series.Values = new ChartNumericData(new double[] { 25, 15, 12, 19, 21, 32 });
    
            // Add the series to the chart.
            chart.Series.Add(series);
    
            // Access and configure the chart view.
            ChartOfPieView view = chart.Views[0] as ChartOfPieView;
            view.SeriesLineProperties = new ChartElement { Fill = new SolidFill(Color.DarkGray) };
            view.VaryColors = true;
    
            // Configure data labels and split options.
            view.DataLabels.ShowValue = true;
            view.DataLabels.ShowCategoryName = true;
            view.SplitType = ChartOfPieSplitType.Value;
            view.SplitPosition = 20;
            view.GapWidth = 50;
            view.SecondChartType = ChartOfPieType.Bar;
    
            // 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

    See Also