This documentation is archived and is not being maintained.

Chart.XYGroups Method

On a 2-D chart, returns an object that represents either a single scatter chart group (a ChartGroup object) or a collection of the scatter chart groups (a ChartGroups collection).

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public Object XYGroups (
	[OptionalAttribute] Object Index
)

Parameters

Index

Specifies the chart group.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example creates an XY scatter chart Chart and then uses the XYGroups method to display the axis group.

private void UseXYGroups()
{
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;

    Microsoft.Office.Tools.Excel.Chart chart1 =
        this.Controls.AddChart(this.Range["D2", "H12"], 
        "chart1");

    chart1.SetSourceData(this.Range["A1", "B5"], 
        Excel.XlRowCol.xlColumns);
    chart1.ChartType = Excel.XlChartType.xlXYScatterLines;

    Excel.ChartGroup group =
        (Excel.ChartGroup)chart1.XYGroups(1);

    MessageBox.Show("The axis group is: " + 
        group.AxisGroup.ToString());
}

Show: