Skip to main content
All docs
V26.1
  • ChartAxisGroupType Enum

    Lists values that specify an axis group for chart series and views.

    Namespace: DevExpress.Docs.Office

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

    Declaration

    public enum ChartAxisGroupType

    Members

    Name Description
    Primary

    Uses primary axes.

    Secondary

    Uses secondary axes.

    Example

    The following code snippet adds two line series to the primary axes and one line series to the secondary axes:

    DevExpress Presentation API - Charts with a secondary axis

    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;
    
            // Specify data for the chart.
            chart.Data[0, "A1"].NumericValue = 120;
            chart.Data[0, "A2"].NumericValue = 95;
            chart.Data[0, "A3"].NumericValue = 140;
            chart.Data[0, "A4"].NumericValue = 100;
            chart.Data[0, "A5"].NumericValue = 80;
            chart.Data[0, "B1"].NumericValue = 10;
            chart.Data[0, "B2"].NumericValue = 20;
            chart.Data[0, "B3"].NumericValue = 30;
            chart.Data[0, "B4"].NumericValue = 40;
            chart.Data[0, "B5"].NumericValue = 50;
    
            chart.Data[0, "C1"].NumericValue = 6000;
            chart.Data[0, "C2"].NumericValue = 10500;
            chart.Data[0, "C3"].NumericValue = 10000;
            chart.Data[0, "C4"].NumericValue = 7000;
            chart.Data[0, "C5"].NumericValue = 9500;
    
            chart.Data[0, "D1"].NumericValue = 180;
            chart.Data[0, "D2"].NumericValue = 95;
            chart.Data[0, "D3"].NumericValue = 120;
            chart.Data[0, "D4"].NumericValue = 80;
            chart.Data[0, "D5"].NumericValue = 130;
    
            // Add the first series to the chart.
            LineSeries series1 = new LineSeries();
            series1.Values = new ChartDataReference(sheetIndex: 0, fromCellReference: "A1", toCellReference: "A5");
            series1.Arguments = new ChartDataReference(sheetIndex: 0, fromCellReference: "B1", toCellReference: "B5");
            chart.Series.Add(series1);
    
            // Add the second series to the chart.
            LineSeries series2 = new LineSeries();
            series2.Values = new ChartDataReference(sheetIndex: 0, fromCellReference: "D1", toCellReference: "D5");
            series2.Arguments = new ChartDataReference(sheetIndex: 0, fromCellReference: "B1", toCellReference: "B5");
            chart.Series.Add(series2);
    
            // Add the third series to the chart and assign it to the secondary axes.
            LineSeries series3 = new LineSeries();
            series3.Values = new ChartDataReference(sheetIndex: 0, fromCellReference: "C1", toCellReference: "C5");
            series3.Arguments = new ChartDataReference(sheetIndex: 0, fromCellReference: "B1", toCellReference: "B5");
            series3.AxisGroup = ChartAxisGroupType.Secondary;
            chart.Series.Add(series3);
    
            // Remove the legend.
            chart.Legend = null;
    
            // Customize the primary argument axis.
            CategoryAxis? xAxis = chart.ArgumentAxis as CategoryAxis;
            if (xAxis != null) {
                xAxis.MajorTickMark = AxisTickMarkType.Cross;
                xAxis.MinorTickMark = AxisTickMarkType.Inside;
                xAxis.LabelTextProperties = new TextProperties { FontSize = 30 };
            }
            // Customize the primary value axis.
            ValueAxis? yAxis = chart.ValueAxis;
            if (yAxis != null) {
                yAxis.CrossPositionType = AxisCrossPositionType.OnTickMarks;
                yAxis.LabelTextProperties = new TextProperties { FontSize = 30 };
            }
            // Hide the secondary argument axis.
            chart.SecondaryArgumentAxis.Visible = false;
    
            // Customize the secondary value axis.
            ValueAxis? secYAxis = chart.SecondaryValueAxis;
            if (secYAxis != null) {
                secYAxis.Position = AxisPositionType.Right;
                secYAxis.LabelTextProperties = new TextProperties { FontSize = 30 };
    
            }
            // Customize data labels for the first two series.
            LineChartView lineView1 = (LineChartView)chart.Views[0];
            lineView1.DataLabels.ShowCategoryName = true;
            lineView1.DataLabels.ShowValue = true;
    
            // Customize data labels for the third series.
            LineChartView lineView2 = (LineChartView)chart.Views[1];
            lineView2.DataLabels.ShowValue = true;
        }
    }
    
    See Also