Class DataLabels
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates a collection of all the DataLabel objects for the specified Series.
public class DataLabels : ChartTextFrame
Inheritance
object ← ChartFrame ← ChartTextFrame ← DataLabels
Inherited Members
ChartTextFrame.m_IsAutoText, ChartTextFrame.m_deleted, ChartTextFrame.horizontal, ChartTextFrame.vertical, ChartTextFrame.rotation, ChartTextFrame.m_CharsList, ChartTextFrame.Characters(int, int), ChartTextFrame.IsAutoText, ChartTextFrame.IsDeleted, ChartTextFrame.TextHorizontalAlignment, ChartTextFrame.TextVerticalAlignment, ChartTextFrame.RotationAngle, ChartTextFrame.IsAutomaticRotation, ChartTextFrame.Text, ChartTextFrame.LinkedSource, ChartTextFrame.ReadingOrder, ChartTextFrame.DirectionType, ChartTextFrame.IsTextWrapped, ChartTextFrame.IsResizeShapeToFitText, ChartFrame.m_IsAutoXPos, ChartFrame.m_IsAutoYPos, ChartFrame.m_IsOffsetPosBeSet, ChartFrame.m_fontIndex, ChartFrame.m_AutoScaleFont, ChartFrame.m_BackgroundMode, ChartFrame.m_isAutoSize, ChartFrame.SetPositionAuto(), ChartFrame.IsInnerMode, ChartFrame.Border, ChartFrame.Area, ChartFrame.TextOptions, ChartFrame.Font, ChartFrame.AutoScaleFont, ChartFrame.BackgroundMode, ChartFrame.IsAutomaticSize, ChartFrame.X, ChartFrame.Y, ChartFrame.Height, ChartFrame.Width, ChartFrame.Shadow, ChartFrame.ShapeProperties, ChartFrame.IsDefaultPosBeSet, ChartFrame.DefaultX, ChartFrame.DefaultY, ChartFrame.DefaultWidth, ChartFrame.DefaultHeight, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
//Set the DataLabels in the chart
Workbook wb = new Workbook("chart.xlsx");
Chart chart = wb.Worksheets[0].Charts[0];
DataLabels datalabels;
for (int i = 0; i <chart.NSeries.Count; i++)
{
datalabels = chart.NSeries[i].DataLabels;
//Set the position of DataLabels
datalabels.Position = LabelPositionType.InsideBase;
//Show the category name in the DataLabels
datalabels.ShowCategoryName = true;
//Show the value in the DataLabels
datalabels.ShowValue = true;
//Not show the percentage in the DataLabels
datalabels.ShowPercentage = false;
//Not show the legend key.
datalabels.ShowLegendKey = false;
}
'Set the DataLabels in the chart
Dim datalabels As DataLabels
Dim i As Integer
For i = 0 To chart.NSeries.Count - 1 Step 1
datalabels = chart.NSeries(i).DataLabels
'Set the position of DataLabels
datalabels.Position = LabelPositionType.InsideBase
'Show the category name in the DataLabels
datalabels.ShowCategoryName= True
'Show the value in the DataLabels
datalabels.ShowValue = True
'Not show the percentage in the DataLabels
datalabels.ShowPercentage = False
'Not show the legend key.
datalabels.ShowLegendKey = False
Next
Properties
Area
Gets the Aspose.Cells.Charts.DataLabels.Area?text=area.
public override Area Area { get; }
Property Value
BackgroundMode
Gets and sets the display mode of the background
public BackgroundMode BackgroundMode { get; set; }
Property Value
Border
Gets the Aspose.Cells.Drawing.Line?text=border.
public override Line Border { get; }
Property Value
DirectionType
Gets and sets the direction of text.
public override ChartTextDirectionType DirectionType { get; set; }
Property Value
Font
Gets the font of the DataLabels;
public override Font Font { get; }
Property Value
IsAutoText
Indicates the text is auto generated.
public override bool IsAutoText { get; set; }
Property Value
IsNeverOverlap
Indicates whether the datalabels display never overlap. (For Pie chart)
public bool IsNeverOverlap { get; set; }
Property Value
IsTextWrapped
Gets or sets a value indicating whether the text is wrapped.
public override bool IsTextWrapped { get; set; }
Property Value
Number
Gets and sets the built-in number format.
public int Number { get; set; }
Property Value
NumberFormat
Represents the format string for the DataLabels object.
public string NumberFormat { get; set; }
Property Value
NumberFormatLinked
True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells).
public bool NumberFormatLinked { get; set; }
Property Value
Position
Represents the position of the data label.
public LabelPositionType Position { get; set; }
Property Value
SeparatorType
Gets or sets the separator type used for the data labels on a chart.
public DataLabelsSeparatorType SeparatorType { get; set; }
Property Value
Remarks
To set custom separator, please set the property Aspose.Cells.Charts.DataLabels.SeparatorType as Aspose.Cells.Charts.DataLabelsSeparatorType.Custom and then specify the expected value for Aspose.Cells.Charts.DataLabels.SeparatorValue.
SeparatorValue
Gets or sets the separator value used for the data labels on a chart.
public string SeparatorValue { get; set; }
Property Value
ShapeType
Gets or sets shape type of data label.
public DataLabelShapeType ShapeType { get; set; }
Property Value
ShowBubbleSize
Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
public bool ShowBubbleSize { get; set; }
Property Value
ShowCategoryName
Represents a specified chart’s data label category name display behavior.True to display the category name for the data labels on a chart. False to hide.
public bool ShowCategoryName { get; set; }
Property Value
ShowCellRange
Indicates whether showing cell range as the data labels.
public bool ShowCellRange { get; set; }
Property Value
ShowLegendKey
Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.
public bool ShowLegendKey { get; set; }
Property Value
ShowPercentage
Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
public bool ShowPercentage { get; set; }
Property Value
ShowSeriesName
Indicates whether the series name displays for the data labels on a chart. True to show the series name. False to hide.
public bool ShowSeriesName { get; set; }
Property Value
ShowValue
Represents a specified chart’s data label values display behavior. True displays the values. False to hide.
public bool ShowValue { get; set; }
Property Value
Text
Gets or sets the text of data label.
public override string Text { get; set; }
Property Value
Methods
ApplyFont()
Apply the font of the datalabels to all child nodes.
public void ApplyFont()