ApplyDataLabels Method

Applies To

Chart object, Point object, Series object.

Description

Applies data labels to a point, a series, or all the series in a chart.

Syntax

expression.ApplyDataLabels(Type, LegendKey)

expression Required. An expression that returns a Chart, Point, or Series object.

Type Optional Variant. The data label type. Can be one of the following XlDataLabelsType constants.

Constant

Description

xlDataLabelsShowNone

No data labels.

xlDataLabelsShowValue

Value for the point (assumed if this argument isn't specified).

xlDataLabelsShowPercent

Percentage of the total. Available only for pie charts and doughnut charts.

xlDataLabelsShowLabel

Category for the point. This is the default value.

xlDataLabelsShowLabelAndPercent

Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.


LegendKey Optional Variant. True to show the legend key next to the point. The default value is False.

See Also

DataLabel property, HasDataLabel property, HasDataLabels property.

Example

This example applies category labels to series one in Chart1.

Charts("Chart1").SeriesCollection(1). _
    ApplyDataLabels Type:=xlDataLabelsShowLabel