GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ChartDataLabels Class

    Namespace:
    GemBox.Spreadsheet.Charts
    Assembly:
    GemBox.Spreadsheet.dll

    Represents the settings for the data labels for an entire series or the entire chart.

    • C#
    • VB.NET
    public sealed class ChartDataLabels
    Public NotInheritable Class ChartDataLabels
    Inheritance:
    System.Object
    ChartDataLabels

    Properties

    CachedLabelValues

    Gets or sets a collection of cached label values that represent pre-calculated or custom values to be displayed in data labels.

    • C#
    • VB.NET
    public ICollection<string> CachedLabelValues { get; set; }
    Public Property CachedLabelValues As ICollection(Of String)
    Property Value
    System.Collections.Generic.ICollection<System.String>

    A collection of pre-calculated or custom label values, or null if no cached values are provided.

    CustomLayout

    Gets or sets the data label's custom layout.

    • C#
    • VB.NET
    public ChartElementLayout CustomLayout { get; set; }
    Public Property CustomLayout As ChartElementLayout
    Property Value
    ChartElementLayout

    The configuration of how the data labels should be positioned inside the chart.

    Remarks

    Custom layout is not supported by ChartSeries and ExcelChart and its derived classes. For those instances property will always return null and setting the value will have no effect.

    Fill

    Gets or sets the fill formatting options.

    • C#
    • VB.NET
    public FillFormat Fill { get; set; }
    Public Property Fill As FillFormat
    Property Value
    FillFormat

    The fill formatting options.

    LabelContainsCategoryName

    Gets or sets a value indicating whether the category name should be shown in a data label.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public bool LabelContainsValue { get; set; }
    Public Property LabelContainsValue As Boolean
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public DataLabelPosition LabelPosition { get; set; }
    Public Property LabelPosition As DataLabelPosition
    Property Value
    DataLabelPosition

    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.

    • C#
    • VB.NET
    public string NumberFormat { get; set; }
    Public Property NumberFormat As String
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public LineFormat Outline { get; set; }
    Public Property Outline As LineFormat
    Property Value
    LineFormat

    The outline formatting options.

    Separator

    Gets or sets the text that should be used to separate the parts of a data label.

    • C#
    • VB.NET
    public string Separator { get; set; }
    Public Property Separator As String
    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.

    • C#
    • VB.NET
    public bool ShowLeaderLines { get; set; }
    Public Property ShowLeaderLines As Boolean
    Property Value
    System.Boolean

    true if leader lines should be shown for data labels; otherwise, false.

    TextFormat

    Gets or sets the text formatting options.

    • C#
    • VB.NET
    public TextFormat TextFormat { get; set; }
    Public Property TextFormat As TextFormat
    Property Value
    TextFormat

    The text formatting options.

    Methods

    Delete()

    Deletes data labels.

    • C#
    • VB.NET
    public void Delete()
    Public Sub Delete

    Show()

    Shows the value in the data label.

    • C#
    • VB.NET
    public void Show()
    Public Sub Show

    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this ChartDataLabels instance.

    Overrides
    System.Object.ToString()
    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).

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.