Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Applies data labels to a point, a series, or all the series in a Chart control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: 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
Type
Type: Microsoft.Office.Interop.Excel.XlDataLabelsTypeXlDataLabelsType. The type of data label to apply.
LegendKey
Type: System.Objecttrue to show the legend key next to the point. The default value is false.
AutoText
Type: System.Objecttrue if the object automatically generates appropriate text based on content.
HasLeaderLines
Type: System.ObjectFor the Chart and Series objects, true if the series has leader lines.
ShowSeriesName
Type: System.ObjectThe series name for the data label.
ShowCategoryName
Type: System.ObjectThe category name for the data label.
ShowValue
Type: System.ObjectThe value for the data label.
ShowPercentage
Type: System.ObjectThe percentage for the data label.
ShowBubbleSize
Type: System.ObjectThe bubble size for the data label.
Separator
Type: System.ObjectThe separator for the data label.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example creates a Chart and then uses the ApplyDataLabels method to display data labels with the series names on the chart.
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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.