Chart.GetChartElement(Int32, Int32, Int32, Int32, Int32) Method

Definition

Returns information about the chart element at specified X and Y coordinates. This method is unusual in that you specify values for only the first two arguments. Microsoft Word fills in the other arguments, and your code should examine those values when the method returns.

public:
 void GetChartElement(int x, int y, [Runtime::InteropServices::Out] int % ElementID, [Runtime::InteropServices::Out] int % Arg1, [Runtime::InteropServices::Out] int % Arg2);
public void GetChartElement (int x, int y, out int ElementID, out int Arg1, out int Arg2);
abstract member GetChartElement : int * int * int * int * int -> unit
Public Sub GetChartElement (x As Integer, y As Integer, ByRef ElementID As Integer, ByRef Arg1 As Integer, ByRef Arg2 As Integer)

Parameters

x
Int32

Required Integer The X coordinate of the chart element.

y
Int32

Required Integer The Y coordinate of the chart element.

ElementID
Int32

Integer When the method returns, this argument contains the XlChartItem value of the chart element at the specified coordinates. For more information, see the “Remarks” section.

Arg1
Int32

Integer When the method returns, this argument contains information related to the chart element. For more information, see the “Remarks” section.

Arg2
Int32

Integer When the method returns, this argument contains information related to the chart element. For more information, see the “Remarks” section.

Remarks

The value of ElementID after the method returns determines whether Arg1 and Arg2 contain any information, as shown in the following table.

xlAxis 21AxisIndexAxisType
xlAxisTitle 17AxisIndexAxisType
xlDisplayUnitLabel 30AxisIndexAxisType
xlMajorGridlines 15AxisIndexAxisType
xlMinorGridlines 16AxisIndexAxisType
xlPivotChartDropZone 32DropZoneTypeNone
xlPivotChartFieldButton 31DropZoneTypeNone
xlDownBars 20GroupIndexNone
xlDropLines 26GroupIndexNone
xlHiLoLines 25GroupIndexNone
xlRadarAxisLabels 27GroupIndexNone
xlSeriesLines 22GroupIndexNone
xlUpBars 18GroupIndexNone
xlChartArea 2NoneNone
xlChartTitle 4NoneNone
xlCorners 6NoneNone
xlDataTable 7NoneNone
xlFloor 23NoneNone
xlLeaderLines 29NoneNone
xlLegend 24NoneNone
xlNothing 28NoneNone
xlPlotArea 19NoneNone
xlWalls 5NoneNone
xlDataLabel 7SeriesIndexPointIndex
xlErrorBars 9SeriesIndexNone
xlLegendEntry 12SeriesIndexNone
xlLegendKey 13SeriesIndexNone
xlSeries 3SeriesIndexPointIndex
xlShape 14ShapeIndexNone
xlTrendline 8SeriesIndexTrendLineIndex
xlXErrorBars 10SeriesIndexNone
xlYErrorBars 11SeriesIndexNone

The following table describes the meaning of Arg1 and Arg2 after the method returns.

AxisIndexSpecifies whether the axis is primary or secondary. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.
AxisTypeSpecifies the axis type. Can be one of the following XlAxisType constants: xlCategory, xlSeriesAxis, or xlValue.
DropZoneTypeSpecifies the drop zone type: column, data, page, or row field. Can be one of the following XlPivotFieldOrientation constants: xlColumnField, xlDataField, xlPageField, or xlRowField. The column and row field constants specify the series and category fields, respectively.
GroupIndexSpecifies the offset within the ChartGroups collection for a specific chart group.
PointIndexSpecifies the offset within the Points collection for a specific point within a series. A value of – 1 indicates that all data points are selected.
SeriesIndexSpecifies the offset within the Series collection for a specific series.
ShapeIndexSpecifies the offset within the Shapes collection for a specific shape.
TrendlineIndexSpecifies the offset within the Trendlines collection for a specific trendline within a series.

Applies to