[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Drawing.IDataLabel

IDataLabel Interface

Represents the data label on a chart point or trendline.

Use this interface to configure the text content, position, number format, and visual formatting of a chart data label. An IDataLabel can be obtained from a chart point or from a trendline equation label. The parent returned by Parent can therefore be an IPoint or an ITrendline.

Namespace: GrapeCity.Documents.Excel.Drawing
Assembly: DS.Documents.Excel.dll
Syntax
public interface IDataLabel
Public Interface IDataLabel
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {null, "Sales"}, {"Q1", 12}, {"Q2", 18}, {"Q3", 15}
};
IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 230);
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:B4"], RowCol.Columns, true, true);
ISeries series = shape.Chart.SeriesCollection[0];
series.HasDataLabels = true;
IDataLabel dataLabel = series.Points[1].DataLabel;
dataLabel.ShowValue = true;

Properties

Name Description
AutoText

Gets or sets whether the object automatically generates text based on its current context.

When this property is true, the data label text is generated from the chart data and label settings. When it is false, the label uses explicitly assigned text.

Direction

Gets or sets the text direction of the data label.

Use this property to determine how the data label text is oriented, such as horizontal, vertical, or rotated layout.

Font

Gets the IFontFormat object that represents the font settings of the data label.

Use the returned IFontFormat object to read or modify the font applied to the data label text.

Format

Gets the IChartFormat object for the data label.

NumberFormat

Gets or sets the number format code used by the data label.

This property returns the format code currently applied to the label value. If the label does not define its own number format, it can use the inherited format from its parent data labels. When no custom format is available, this method returns "General".

NumberFormatLinked

Gets or sets whether the data label number format is linked to the source cells.

If this property is true, changes to the number format in the source cells are reflected in the data label.

Orientation

Gets or sets the text orientation of the data label.

The returned value is the rotation angle of the data label text, in degrees.

Parent

Gets the parent object of the data label.

The returned object can be a IPoint or an ITrendline, depending on whether the data label belongs to a chart point or a trendline. Starting with version 7.0.0, this property returns object instead of IPoint.

Position

Gets or sets the position of the data label.

Use this property to determine how the current data label is positioned relative to its chart point or series element.

Separator

Gets or sets the separator used between parts of the data label text on a chart.

This separator is used when the data label displays multiple elements, such as the series name, category name, value, or percentage.

ShowBubbleSize

Gets or sets whether the data label displays the bubble size.

This property applies to data labels on bubble charts.

ShowCategoryName

Gets or sets whether the category name is displayed in the data label.

If this property returns true, the data label shows the category name for the associated chart point. If it returns false, the category name is hidden.

ShowLegendKey

Gets or sets whether the data label legend key is visible.

If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

ShowPercentage

Gets or sets whether the percentage value is displayed in the data label.

If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

ShowSeriesName

Gets or sets whether the series name is displayed in the data label.

Use this property to determine whether the data label shows the name of the associated series.

ShowValue

Gets or sets whether the data label displays the value of its associated chart point or trendline.

When this property is true, the data label shows the value. When it is false, the value is hidden.

Text

Gets or sets the text of the data label.

Returns the current text displayed by the data label. If the data label uses automatic text, this property returns the generated label text.

TextFrame

Gets the ITextFrame object that contains the text and font style properties of the data label.

Methods

Name Description
Delete()

Deletes this data label.

Removes the data label from its parent chart point or trendline.