Share via


ChartSheet.ApplyDataLabels Method

Applies data labels to a point, a series, or all the series in a Microsoft.Office.Tools.Excel.ChartSheet.

Namespace:  Microsoft.Office.Tools.Excel
Assemblies:   Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.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 _
)
void ApplyDataLabels(
    XlDataLabelsType Type,
    Object LegendKey,
    Object AutoText,
    Object HasLeaderLines,
    Object ShowSeriesName,
    Object ShowCategoryName,
    Object ShowValue,
    Object ShowPercentage,
    Object ShowBubbleSize,
    Object Separator
)

Parameters

  • LegendKey
    Type: System.Object

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

  • AutoText
    Type: System.Object

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

  • ShowSeriesName
    Type: System.Object

    The series name for the data label.

  • ShowCategoryName
    Type: System.Object

    The category name for the data label.

  • ShowPercentage
    Type: System.Object

    The percentage for the data label.

  • ShowBubbleSize
    Type: System.Object

    The bubble size for the data label.

  • Separator
    Type: System.Object

    The separator for the data label.

Remarks

Optional Parameters

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

Examples

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

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
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);
}

.NET Framework Security

See Also

Reference

ChartSheet Interface

Microsoft.Office.Tools.Excel Namespace