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

    Displays data as a scatter chart.

    Namespace: DevExpress.Docs.Office

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

    NuGet Package: DevExpress.Docs.Core

    Declaration

    public class ScatterSeries :
        SeriesBase

    Remarks

    The following code snippet creates a scatter chart and adds it to a presentation:

    DevExpress Presentation API - Scatter Chart Example

    using DevExpress.Docs.Presentation;
    using DevExpress.Docs.Office;
    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;
    
            // Populate X-axis values.
            chart.Data[0, "A1"].NumericValue = 1;
            chart.Data[0, "A2"].NumericValue = 3;
            chart.Data[0, "A3"].NumericValue = 4;
            chart.Data[0, "A4"].NumericValue = 2;
            chart.Data[0, "A5"].NumericValue = 5;
    
            // Populate Y-axis values.
            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 scatter series and bind it to worksheet ranges.
            ScatterSeries series = new ScatterSeries();
            series.Arguments = new ChartDataReference("A1", "A5");
            series.Values = new ChartDataReference("B1", "B5");
            chart.Series.Add(series);
    
            // Configure data labels.
            series.DataLabels.ShowValue = true;
            series.DataLabels.ShowCategoryName = true;
    
            // Set marker appearance.
            series.Marker = new Marker { Symbol = MarkerStyle.Circle, Size = 10, Fill = new SolidFill(Color.Red) };
    
            // 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

    See Also