Compartir a través de


Chart.ApplyDataLabels (Método)

Aplica etiquetas de datos a un punto, una serie o todas las series de un control Chart.

Espacio de nombres:  Microsoft.Office.Tools.Excel
Ensamblado:  Microsoft.Office.Tools.Excel (en Microsoft.Office.Tools.Excel.dll)

Sintaxis

'Declaración
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
)

Parámetros

  • LegendKey
    Tipo: System.Object
    true para mostrar la clave de leyenda junto al punto.El valor predeterminado es false.
  • AutoText
    Tipo: System.Object
    true si el objeto genera automáticamente el texto adecuado a partir del contenido.
  • ShowSeriesName
    Tipo: System.Object
    Nombre de serie de la etiqueta de datos.
  • ShowCategoryName
    Tipo: System.Object
    Nombre de categoría de la etiqueta de datos.
  • ShowPercentage
    Tipo: System.Object
    Porcentaje de la etiqueta de datos.
  • ShowBubbleSize
    Tipo: System.Object
    Tamaño de burbuja de la etiqueta de datos.
  • Separator
    Tipo: System.Object
    Separador de la etiqueta de datos.

Comentarios

Parámetros opcionales

Para obtener información sobre parámetros opcionales, vea Parámetros opcionales en las soluciones de Office.

Ejemplos

En el siguiente ejemplo de código se crea un control Chart y, a continuación, se utiliza el método ApplyDataLabels para mostrar las etiquetas de datos con los nombres de serie en el gráfico.

Private Sub DisplayLabels()
    Me.Range("A1", "A5").Value2 = 22
    Me.Range("B1", "B5").Value2 = 55

    Dim Chart1 As Microsoft.Office.Tools.Excel.Chart = _
        Me.Controls.AddChart(Me.Range("D2", "H20"), "Chart1")

    Chart1.SetSourceData(Me.Range("A1", "B5"), Excel.XlRowCol.xlColumns)
    Chart1.ChartType = Excel.XlChartType.xlBarClustered

    Chart1.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabel, _
        False, False, False, True, False, False, False, False, False)
End Sub
private void DisplayLabels()
{
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;

    Microsoft.Office.Tools.Excel.Chart chart1 =
        this.Controls.AddChart(this.Range["D2", "H20"], 
        "chart1");

    chart1.SetSourceData(this.Range["A1", "B5"], 
        Excel.XlRowCol.xlColumns);
    chart1.ChartType = Excel.XlChartType.xlBarClustered;

    chart1.ApplyDataLabels(
        Excel.XlDataLabelsType.xlDataLabelsShowLabel,
        false, false, false, true, false, false, false, 
        false, false);
}

Seguridad de .NET Framework

Vea también

Referencia

Chart Interfaz

Microsoft.Office.Tools.Excel (Espacio de nombres)