Compartilhar via


ChartSheet.ApplyDataLabels Method

Definition

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

public void ApplyDataLabels (Microsoft.Office.Interop.Excel.XlDataLabelsType Type = Microsoft.Office.Interop.Excel.XlDataLabelsType.xlDataLabelsShowValue, object LegendKey, object AutoText, object HasLeaderLines, object ShowSeriesName, object ShowCategoryName, object ShowValue, object ShowPercentage, object ShowBubbleSize, object Separator);
abstract member ApplyDataLabels : Microsoft.Office.Interop.Excel.XlDataLabelsType * obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub ApplyDataLabels (Optional Type As XlDataLabelsType = Microsoft.Office.Interop.Excel.XlDataLabelsType.xlDataLabelsShowValue, Optional LegendKey As Object, Optional AutoText As Object, Optional HasLeaderLines As Object, Optional ShowSeriesName As Object, Optional ShowCategoryName As Object, Optional ShowValue As Object, Optional ShowPercentage As Object, Optional ShowBubbleSize As Object, Optional Separator As Object)

Parameters

Type
XlDataLabelsType

The type of data label to apply.

LegendKey
Object

true to show the legend key next to the point. The default value is false.

AutoText
Object

true if the object automatically generates appropriate text based on content.

HasLeaderLines
Object

For the Chart and Series objects, true if the series has leader lines.

ShowSeriesName
Object

The series name for the data label.

ShowCategoryName
Object

The category name for the data label.

ShowValue
Object

The value for the data label.

ShowPercentage
Object

The percentage for the data label.

ShowBubbleSize
Object

The bubble size for the data label.

Separator
Object

The separator for the data label.

Examples

The following code example uses the ApplyDataLabels method to show the data values in the current Microsoft.Office.Tools.Excel.ChartSheet.

private void ShowDataLabels()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ApplyDataLabels(
        Excel.XlDataLabelsType.xlDataLabelsShowValue,
        true, false, false, true, true, false, 
        true);
}
Private Sub ShowDataLabels()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowValue, _
        AutoText:=True, HasLeaderLines:=False, ShowSeriesName:=False, _
        ShowCategoryName:=True, ShowValue:=True, ShowPercentage:=False, _
        ShowBubbleSize:=True)
End Sub

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to