Chart.ApplyDataLabels Method
Applies data labels to all the series in a chart.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
Sub ApplyDataLabels ( _
Type As XlDataLabelsType, _
LegendKey As Object, _
AutoText As Object, _
HasLeaderLines As Object, _
ShowSeriesName As Object, _
ShowCategoryName As Object, _
ShowValue As Object, _
ShowPercentage As Object, _
ShowBubbleSize As Object, _
Separator As Object _
)
'Usage
Dim instance As Chart
Dim Type As XlDataLabelsType
Dim LegendKey As Object
Dim AutoText As Object
Dim HasLeaderLines As Object
Dim ShowSeriesName As Object
Dim ShowCategoryName As Object
Dim ShowValue As Object
Dim ShowPercentage As Object
Dim ShowBubbleSize As Object
Dim Separator As Object
instance.ApplyDataLabels(Type, LegendKey, _
AutoText, HasLeaderLines, ShowSeriesName, _
ShowCategoryName, ShowValue, ShowPercentage, _
ShowBubbleSize, Separator)
void ApplyDataLabels(
XlDataLabelsType Type,
Object LegendKey,
Object AutoText,
Object HasLeaderLines,
Object ShowSeriesName,
Object ShowCategoryName,
Object ShowValue,
Object ShowPercentage,
Object ShowBubbleSize,
Object Separator
)
Parameters
- Type
Type: Microsoft.Office.Interop.PowerPoint.XlDataLabelsType
One of the enumeration values that specifies the type of data label to apply.
- LegendKey
Type: System.Object
true to show the legend key next to the point. The default is false.
- AutoText
Type: System.Object
true if the object automatically generates appropriate text based on content.
- HasLeaderLines
Type: System.Object
For the Chart and Series objects, true if the series has leader lines.
- ShowSeriesName
Type: System.Object
true to enable the series name for the data label; otherwise, false.
- ShowCategoryName
Type: System.Object
true to enable the category name for the data label; otherwise, false.
- ShowValue
Type: System.Object
true to enable the value for the data label; otherwise, false.
- ShowPercentage
Type: System.Object
true to enable the percentage for the data label; otherwise, false.
- ShowBubbleSize
Type: System.Object
true to enable the bubble size for the data label; otherwise, false.
- Separator
Type: System.Object
The separator for the data label.
Remarks
Note
If you use a string for the Separator parameter, 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.
The Type parameter can be one of the following XlDataLabelsType constants.
Constant |
Description |
---|---|
The bubble size for the data label. |
|
The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts. |
|
The percentage of the total. Available only for pie charts and doughnut charts. |
|
The category for the point. |
|
No data labels. |
|
(Default) The value for the point (assumed if this argument is not specified). |