| ET 开发人员参考 |
| Chart.ApplyDataLabels 方法 |
语法
表达式.ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)
表达式 一个代表 Chart 对象的变量。
参数
| 名称 | 必选/可选 | 数据类型 | 说明 |
|---|---|---|---|
| Type | 可选 | XlDataLabelsType | 要应用的数据标签的类型。 |
| LegendKey | 可选 | Variant | 如果为 True,则在数据点旁边显示图例项标示。默认值为 False。 |
| AutoText | 可选 | Variant | 如果对象根据内容自动生成相应的文字,则为 True。 |
| HasLeaderLines | 可选 | Variant | 对于 Chart 和 Series 对象,如果数据系列有引导线,则为 True。 |
| ShowSeriesName | 可选 | Variant | 传递布尔值以启用或禁用数据标签的系列名称。 |
| ShowCategoryName | 可选 | Variant | 传递布尔值以启用或禁用数据标签的分类名称。 |
| ShowValue | 可选 | Variant | 传递布尔值以启用或禁用数据标签的值。 |
| ShowPercentage | 可选 | Variant | 传递布尔值以启用或禁用数据标签的百分比。 |
| ShowBubbleSize | 可选 | Variant | 传递布尔值以启用或禁用数据标签的气泡大小。 |
| Separator | 可选 | Variant | 数据标签的分隔符。 |
注释 |
|---|
| When using the Separator parameter. If you use a string, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline, depending on the data label. When a value of "1" is returned, it indicates that the user has not changed the default separator which is a comma ",". You can also pass a value of "1" to change the separator back to the default separator. The chart must first be active before you can access the data labels programmatically; otherwise a run-time error occurs. |
说明
| XlDataLabelsType 可为以下 XlDataLabelsType 常量之一。 |
| xlDataLabelsShowBubbleSizes。数据标签的气泡尺寸。 |
| xlDataLabelsShowLabelAndPercent。占总数的百分比及数据点所属的分类。仅用于饼图和圆环图。 |
| xlDataLabelsShowPercent。占总数的百分比。仅用于饼图和圆环图。 |
| xlDataLabelsShowLabel。数据点所属的分类。 |
| xlDataLabelsShowNone。无数据标签。 |
| xlDataLabelsShowValue。默认。数据点的值(若未指定此参数,则假定为此值)。 |
示例
本示例对 Chart1 上的第一个数据系列应用分类标签。
| 示例代码 |
|---|
|