Data related procedures in class Series (PowerPoint VBA)

This page presents procedures from class Series related to the theme Data: ApplyDataLabels, DataLabels, HasDataLabels and ParentDataLabelOption

ApplyDataLabels

Applies data labels to a series.

The Type parameter can be one of the following xlDataLabelsType constants:

Syntax : expression.ApplyDataLabels (Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).ApplyDataLabels

Arguments

The following arguments are optional

Type (XlDataLabelsType) - The type of data label to apply.

Possible Values are

xlDataLabelsShowBubbleSizes Show the size of the bubble in reference to the absolute value.
xlDataLabelsShowLabel The category for the point.
xlDataLabelsShowLabelAndPercent The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.
xlDataLabelsShowNone No data labels.
xlDataLabelsShowPercent The percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowValue The default value for the point (assumed if this argument is not specified).

LegendKey (String) - True to show the legend key next to the point. The default is False.

AutoText (Boolean) - True if the object automatically generates appropriate text based on content.

HasLeaderLines (Boolean) - For the Chart and Series objects, True if the series has leader lines.

ShowSeriesName (Boolean) - True to enable the series name for the data label; otherwise, False.

ShowCategoryName (Boolean) - True to enable the category name for the data label; otherwise, False.

ShowValue (Boolean) - True to enable the value for the data label; otherwise, False.

ShowPercentage (Boolean) - True to enable the percentage for the data label; otherwise, False.

ShowBubbleSize (Boolean) - True to enable the bubble size for the data label; otherwise, False.

Separator (String) - The separator for the data label.

DataLabels

Returns an datalabel that represents either a single data label (a DataLabel datalabel) or a collection of all the data labels for the series (a DataLabels collection).

If the series has the Show Value option turned on for the data labels, the returned collection can contain up to one label for each point. Data labels can be turned on or off for individual points in the series. If the series is on an area chart and has the Show Label option turned on for the data labels, the returned collection contains only a single label, which is the label for the area series.

Syntax : expression.DataLabels (Index)

Index: The number of the data label.

Dim dtlDataLabels As DataLabel
Set dtlDataLabels = ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).DataLabels()

HasDataLabels

True if the series has data labels.

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).HasDataLabels = True

ParentDataLabelOption

Specifies the parent data label option (banner, overlapping, or none) for the specified series within the chart group.

Possible Values are xlParentDataLabelOptionsBanner - The parent label layout is a banner above the category, xlParentDataLabelOptionsNone - No parent labels are shown, xlParentDataLabelOptionsOverlapping - The parent label is laid out within the category.
ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).ParentDataLabelOption = xlParentDataLabelOptionsBanner