ChartDataLabels Class
Represents the settings for the data labels for an entire series or the entire chart.
- Inheritance:
- System.ObjectChartDataLabels
Properties
Fill
Gets or sets the fill formatting options.
Property Value
The fill formatting options.
LabelContainsCategoryName
Gets or sets a value indicating whether the category name should be shown in a data label.
public bool LabelContainsCategoryName { get; set; }
Public Property LabelContainsCategoryName As Boolean
Property Value
- System.Boolean
true if the category name should be shown in a data label; otherwise, false.
LabelContainsLegendKey
Gets or sets a value indicating whether the legend key should be shown in a data label.
public bool LabelContainsLegendKey { get; set; }
Public Property LabelContainsLegendKey As Boolean
Property Value
- System.Boolean
true if the legend key should be shown in a data label; otherwise, false.
LabelContainsPercentage
Gets or sets a value indicating whether the percentage should be shown in a data label.
public bool LabelContainsPercentage { get; set; }
Public Property LabelContainsPercentage As Boolean
Property Value
- System.Boolean
true if the percentage should be shown in a data label; otherwise, false.
LabelContainsSeriesName
Gets or sets a value indicating whether the series name should be shown in a data label.
public bool LabelContainsSeriesName { get; set; }
Public Property LabelContainsSeriesName As Boolean
Property Value
- System.Boolean
true if the series name should be shown in a data label; otherwise, false.
LabelContainsValue
Gets or sets a value indicating whether the value should be shown in a data label.
Property Value
- System.Boolean
true if the value should be shown in a data label; otherwise, false.
LabelContainsValueFromCells
Gets or sets value from cells as a cell range reference (for example, 'Sheet1!A1:D1') that should be shown in a data label. Null if value from cells should not be shown.
public string LabelContainsValueFromCells { get; set; }
Public Property LabelContainsValueFromCells As String
Property Value
- System.String
Value from cells that should be shown, null otherwise.
Remarks
Supported only in XLSX and XLSB.
LabelPosition
Gets or sets the position of the data label.
public DataLabelPosition LabelPosition { get; set; }
Public Property LabelPosition As DataLabelPosition
Property Value
The position of the data label.
NumberFormat
Gets or sets the number format used for formatting data labels. If NumberFormatLinkedToSource is true, then number format from chart's source data (cells) will be used to format data labels. Setting this property, sets NumberFormatLinkedToSource to false.
Property Value
- System.String
The number format used for formatting data labels.
NumberFormatLinkedToSource
Gets or sets a value indicating whether number format from chart's source data (cells) will be used to format data labels.
public bool NumberFormatLinkedToSource { get; set; }
Public Property NumberFormatLinkedToSource As Boolean
Property Value
- System.Boolean
true if number format from chart's source data (cells) will be used to format data labels; otherwise, false.
Remarks
Default value of this property is true.
Outline
Gets or sets the outline formatting options.
Property Value
The outline formatting options.
Separator
Gets or sets the text that should be used to separate the parts of a data label.
Property Value
- System.String
The text that should be used to separate the parts of a data label.
ShowLeaderLines
Gets or sets a value indicating whether leader lines should be shown for data labels.
Property Value
- System.Boolean
true if leader lines should be shown for data labels; otherwise, false.
TextFormat
Gets or sets the text formatting options.
Property Value
The text formatting options.
Methods
Delete()
Deletes data labels.
Show()
Shows the value in the data label.
Show(DataLabelPosition)
Shows the value in the data label at the specified position.
ColumnChart and BarChart support Center, InsideEnd, InsideBase and OutsideEnd data label positions.
LineChart supports Center, Left, Right, Top and Bottom data label positions.
PieChart supports Center, InsideEnd, OutsideEnd and BestFit data label positions.
AreaChart supports none of the data label positions. Use Show() overload for AreaChart instead.
DoughnutChart supports none of the data label positions. Use Show() overload for DoughnutChart instead.
public void Show(DataLabelPosition labelPosition)
Public Sub Show(labelPosition As DataLabelPosition)
Parameters
labelPosition
- DataLabelPosition
The position of the label.
Exceptions
- System.NotSupportedException
The specified labelPosition
is not supported for this chart.
ToString()
Returns a System.String that represents this ChartDataLabels instance.
Returns
- System.String
A System.String that represents this ChartDataLabels instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).