Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.1
  • Create a Combo Chart in DevExpress Presentation API

    • 3 minutes to read

    Charts API allows you to create combo charts that combine two or more series types in a single chart. For example, you can combine a line series with a bar series in a Chart to visualize different data series effectively. You can also combine series in a ChartEx.

    The Charts API allows you combine series in a single chart if the series share the same axes. For this reason, you can only plot series displayed in the same dimension (3D charts require an additional series axis and you cannot display them with 2D chart types).

    You will receive a System.InvalidOperationException if you try to combine series with incompatible axes.

    Example: Plot Line, Bar, and Area Series in a Single Chart

    The following code snippet creates a chart that combines a line series, a bar series, and an area series:

    DevExpress Presentation API Combo Chart

    using DevExpress.Docs.Office;
    using DevExpress.Docs.Presentation;
    
    namespace PresentationApiSample;
    
    public class Program {
        public static async Task Main(string[] _) {
    
            Presentation presentation = new Presentation();
    
            presentation.Slides.Clear();
    
            Slide slide = new Slide(SlideLayoutType.Blank);
            presentation.Slides.Add(slide);
    
            Chart chart = new Chart();
            slide.Shapes.Add(chart);
    
            chart.Width = presentation.SlideSize.Width;
            chart.Height = presentation.SlideSize.Height;
    
            chart.ChartData["A1"].TextValue = "Q1";
            chart.ChartData["A2"].TextValue = "Q2";
            chart.ChartData["A3"].TextValue = "Q3";
            chart.ChartData["A4"].TextValue = "Q4";
    
            chart.ChartData["B1"].NumericValue = 40;
            chart.ChartData["B2"].NumericValue = 50;
            chart.ChartData["B3"].NumericValue = 60;
            chart.ChartData["B4"].NumericValue = 55;
    
            chart.ChartData["C1"].NumericValue = 26;
            chart.ChartData["C2"].NumericValue = 30;
            chart.ChartData["C3"].NumericValue = 32;
            chart.ChartData["C4"].NumericValue = 37;
    
            chart.ChartData["D1"].NumericValue = 36;
            chart.ChartData["D2"].NumericValue = 40;
            chart.ChartData["D3"].NumericValue = 42;
            chart.ChartData["D4"].NumericValue = 47;
    
            // Add a line series to the chart and specify its data source.
            LineSeries lineSeries = new LineSeries();
            chart.Series.Add(lineSeries);
            lineSeries.Arguments = new ChartDataReference("A1", "A4");
            lineSeries.Values = new ChartDataReference("B1", "B4");
    
            // Add a bar series to the chart and specify its data source.
            BarSeries barSeries = new BarSeries();
            chart.Series.Add(barSeries);
            barSeries.Arguments = new ChartDataReference("A1", "A4");
            barSeries.Values = new ChartDataReference("C1", "C4");
    
            // Add an area series to the chart and specify its data source.
            AreaSeries areaSeries = new AreaSeries();
            chart.Series.Add(areaSeries);
            areaSeries.Arguments = new ChartDataReference("A1", "A4");
            areaSeries.Values = new ChartDataReference("D1", "D4");
        }
    }