SlicedChartView.FirstSliceAngle Property
Gets or sets the start angle of the first slice.
Namespace: DevExpress.Docs.Office
Assembly: DevExpress.Docs.Core.v26.1.dll
NuGet Package: DevExpress.Docs.Core
Declaration
Property Value
| Type | Description |
|---|---|
| Single | A single-precision value that specifies the angle in degrees. |
Example
The following code snippet adds a pie chart to a slide:
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 pie series with arguments and values.
PieSeries series = new PieSeries();
series.Arguments = new ChartStringData(new string[] { "Category 1", "Category 2", "Category 3", "Category 4", "Category 5" });
series.Values = new ChartNumericData(new double[] { 5.3, 6.1, 3.2, 7.5, 4.3 });
series.CustomDataPoints[0] = new DataPoint { Fill = new SolidFill(Color.Pink) };
series.CustomDataPoints[1] = new DataPoint { Fill = new SolidFill(Color.DeepPink) };
series.CustomDataPoints[2] = new DataPoint { Fill = new SolidFill(Color.HotPink) };
series.CustomDataPoints[3] = new DataPoint { Fill = new SolidFill(Color.LightPink) };
series.CustomDataPoints[4] = new DataPoint { Fill = new SolidFill(Color.Magenta) };
// Add the series to the chart.
chart.Series.Add(series);
// Show data labels.
series.DataLabels.ShowValue = true;
// Set the first slice angle.
PieChartView view = chart.Views[0] as PieChartView;
if (view != null) {
view.FirstSliceAngle = 90;
}
// Save the presentation.
var outputPath = @"D:\presentation.pptx";
using FileStream outputStream = new(outputPath, FileMode.Create, FileAccess.Write, FileShare.None);
presentation.SaveDocument(outputStream);
}
}
See Also