ChartSheetBase.ApplyDataLabels Method

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public 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 _
)
public 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.ChartSheetBase.

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,
        missing, true, false, false, true, true, false, 
        true, missing);
}

.NET Framework Security

See Also

Reference

ChartSheetBase Class

Microsoft.Office.Tools.Excel Namespace