PowerPoint) (Chart.GetChartElement 方法

返回指定的 X 和 Y 坐标处图表元素的相关信息。

语法

expression。 GetChartElement( _x_, _y_, _ElementID_, _Arg1_, _Arg2_ )

expression:一个表示 Chart 对象的变量。

参数

名称 必需/可选 数据类型 说明
x 必需 Long 图表元素的 X 坐标。
y 必需 Long 图表元素的 Y 坐标。
ElementID 必需 Long 方法返回时,此参数包含指定坐标处图表元素的 XlChartItem 值。 有关详细信息,请参阅"备注"部分。
Arg1 必需 Long 方法返回时,此参数包含与图表元素相关的信息。 有关详细信息,请参阅"备注"部分。
Arg2 必需 Long 方法返回时,此参数包含与图表元素相关的信息。 有关详细信息,请参阅“注解”部分。

备注

本方法的与众不同之处在于只需指定前两个参数的值。 Microsoft Word 会为其余参数赋值,代码应在方法返回时检查这些值。

本方法返回的 ElementID 值决定了 Arg1 和 Arg2 是否包含信息,如下表所示。

ElementID 常量 **常量值** Arg1 Arg2
xlAxis 21 AxisIndex AxisType
xlAxisTitle 17 AxisIndex AxisType
xlDisplayUnitLabel 30 AxisIndex AxisType
xlMajorGridlines 15 AxisIndex AxisType
xlMinorGridlines 16 AxisIndex AxisType
xlPivotChartDropZone 32 DropZoneType 无
xlPivotChartFieldButton 31 DropZoneType 无
xlDownBars 20 GroupIndex 无
xlDropLines 26 GroupIndex None
xlHiLoLines 25 GroupIndex 无
xlRadarAxisLabels 27 GroupIndex 无
xlSeriesLines 22 GroupIndex 无
xlUpBars 18 GroupIndex 无
xlChartArea 2 无 无
xlChartTitle 4 无 无
xlCorners 6 无 无
xlDataTable 7 无 无
xlFloor 23 无 无
xlLeaderLines 29 无 无
xlLegend 24 无 无
xlNothing 28 无 无
xlPlotArea 19 无 无
xlWalls 5 无 无
xlDataLabel 7 SeriesIndex PointIndex
xlErrorBars 9 SeriesIndex 无
xlLegendEntry 12 SeriesIndex 无
xlLegendKey 13 SeriesIndex 无
xlSeries 3 SeriesIndex PointIndex
xlShape 14 ShapeIndex 无
xlTrendline 8 SeriesIndex TrendLineIndex
xlXErrorBars 10 SeriesIndex 无
xlYErrorBars 11 SeriesIndex 无

下表说明了方法返回后的参数 Arg1 和 Arg2 的含义。

参数 说明
AxisIndex 指定轴主要或辅助。 可以是下列的 XlAxisGroup 常量之一: xlPrimary 或 xlSecondary 。
AxisType 指定坐标轴类型。 可以是下列的 XlAxisType 常量之一: xlCategory 、 xlSeriesAxis 或 xlValue 。
DropZoneType 指定拖放区域类型: 列、 数据、 页或行字段。 可以是下列的 XlPivotFieldOrientation 常量之一: xlColumnField 、 xlDataField 、 xlPageField 或 xlRowField 。 列和行字段常量分别指定系列和分类字段。
GroupIndex 指定特定图表组的 ChartGroups 集合中的偏移量。
PointIndex 指定系列中的特定点的 点 集合中的偏移量。 值为 1 表示选中所有数据点。
SeriesIndex 指定一系列特定的 系列 集合中的偏移量。
ShapeIndex 指定某一特定形状的 Shapes 集合中的偏移量。
TrendlineIndex 指定 趋势线 集合在一系列内的特定趋势线中的偏移量。

另请参阅

Chart 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。