Aspose::Cells::Charts::DataLabels class

DataLabels class

Encapsulates a collection of all the DataLabel objects for the specified Series.

class DataLabels : public Aspose::Cells::Charts::ChartTextFrame

Methods

MethodDescription
Characters(int32_t startIndex, int32_t length)Returns a Characters object that represents a range of characters within the text.
ChartFrame(ChartFrame_Impl* impl)Constructs from an implementation object.
ChartFrame(const ChartFrame& src)Copy constructor.
ChartTextFrame(ChartTextFrame_Impl* impl)Constructs from an implementation object.
ChartTextFrame(const ChartTextFrame& src)Copy constructor.
ChartTextFrame(const ChartFrame& src)Constructs from a parent object.
DataLabels(DataLabels_Impl* impl)Constructs from an implementation object.
DataLabels(const DataLabels& src)Copy constructor.
DataLabels(const ChartTextFrame& src)Constructs from a parent object.
Get_NumberFormat()Represents the format string for the DataLabels object.
GetArea()Gets the area.
GetAutoScaleFont()True if the text in the object changes font size when the object size changes. The default value is True.
GetBackgroundMode()Gets and sets the display mode of the background.
GetBorder()Gets the border.
GetDefaultHeight()Represents height of default position.
GetDefaultWidth()Represents width of default position.
GetDefaultX()Represents x of default position.
GetDefaultY()Represents y of default position.
GetDirectionType()Gets and sets the direction of text.
GetFont()Gets the font of the DataLabels;.
GetHeight()Gets or sets the height of frame in units of 1/4000 of the chart area.
GetLinkedSource()Gets and sets a reference to the worksheet.
GetNumber()Gets and sets the built-in number format.
GetNumberFormatLinked()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).
GetPosition()Represents the position of the data label.
GetReadingOrder()Represents text reading order.
GetRotationAngle()Represents text rotation angle.
GetSeparatorType()Gets or sets the separator type used for the data labels on a chart.
GetSeparatorValue()Gets or sets the separator value used for the data labels on a chart.
GetShadow()True if the frame has a shadow.
GetShapeProperties()Gets the ShapeProperties object.
GetShapeType()Gets or sets shape type of data label.
GetShowBubbleSize()Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
GetShowCategoryName()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.
GetShowCellRange()Indicates whether showing cell range as the data labels.
GetShowLegendKey()Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.
GetShowPercentage()Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
GetShowSeriesName()Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide.
GetShowValue()Represents a specified chart’s data label values display behavior. True displays the values. False to hide.
GetText()Gets or sets the text of data label.
GetTextHorizontalAlignment()Gets and sets the text horizontal alignment.
GetTextOptions()Gets and sets the options of the text.
GetTextVerticalAlignment()Gets or sets the text vertical alignment of text.
GetWidth()Gets or sets the width of frame in units of 1/4000 of the chart area.
GetX()Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
GetY()Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
IsAutomaticRotation()Indicates whether the text of the chart is automatically rotated.
IsAutomaticSize()Indicates whether the chart frame is automatic sized.
IsAutoText()Indicates the text is auto generated.
IsDefaultPosBeSet()Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
IsDeleted()Indicates whether this data labels is deleted.
IsInnerMode()Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.
IsNeverOverlap()Indicates whether the datalabels display never overlap. (For Pie chart)
IsNull() constChecks whether the implementation object is nullptr.
IsResizeShapeToFitText()Gets or sets whether a shape should be auto-fit to fully contain the text described within it. Auto-fitting is when text within a shape is scaled in order to contain all the text inside.
IsTextWrapped()Gets or sets a value indicating whether the text is wrapped.
explicit operator bool() constoperator bool()
operator=(const DataLabels& src)operator=
operator=(const ChartTextFrame& src)operator=
operator=(const ChartFrame& src)operator=
SetAutoScaleFont(bool value)True if the text in the object changes font size when the object size changes. The default value is True.
SetBackgroundMode(BackgroundMode value)Gets and sets the display mode of the background.
SetDirectionType(ChartTextDirectionType value)Gets and sets the direction of text.
SetHeight(int32_t value)Gets or sets the height of frame in units of 1/4000 of the chart area.
SetIsAutomaticSize(bool value)Indicates whether the chart frame is automatic sized.
SetIsAutoText(bool value)Indicates the text is auto generated.
SetIsDeleted(bool value)Indicates whether this data labels is deleted.
SetIsInnerMode(bool value)Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.
SetIsNeverOverlap(bool value)Indicates whether the datalabels display never overlap. (For Pie chart)
SetIsResizeShapeToFitText(bool value)Gets or sets whether a shape should be auto-fit to fully contain the text described within it. Auto-fitting is when text within a shape is scaled in order to contain all the text inside.
SetIsTextWrapped(bool value)Gets or sets a value indicating whether the text is wrapped.
SetLinkedSource(const U16String& value)Gets and sets a reference to the worksheet.
SetLinkedSource(const char16_t* value)Gets and sets a reference to the worksheet.
SetNumber(int32_t value)Gets and sets the built-in number format.
SetNumberFormat(const U16String& value)Represents the format string for the DataLabels object.
SetNumberFormat(const char16_t* value)Represents the format string for the DataLabels object.
SetNumberFormatLinked(bool value)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).
SetPosition(LabelPositionType value)Represents the position of the data label.
SetPositionAuto()Set position of the frame to automatic.
SetReadingOrder(TextDirectionType value)Represents text reading order.
SetRotationAngle(int32_t value)Represents text rotation angle.
SetSeparatorType(DataLabelsSeparatorType value)Gets or sets the separator type used for the data labels on a chart.
SetSeparatorValue(const U16String& value)Gets or sets the separator value used for the data labels on a chart.
SetSeparatorValue(const char16_t* value)Gets or sets the separator value used for the data labels on a chart.
SetShadow(bool value)True if the frame has a shadow.
SetShapeType(DataLabelShapeType value)Gets or sets shape type of data label.
SetShowBubbleSize(bool value)Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
SetShowCategoryName(bool value)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.
SetShowCellRange(bool value)Indicates whether showing cell range as the data labels.
SetShowLegendKey(bool value)Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.
SetShowPercentage(bool value)Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
SetShowSeriesName(bool value)Returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide.
SetShowValue(bool value)Represents a specified chart’s data label values display behavior. True displays the values. False to hide.
SetText(const U16String& value)Gets or sets the text of data label.
SetText(const char16_t* value)Gets or sets the text of data label.
SetTextHorizontalAlignment(TextAlignmentType value)Gets and sets the text horizontal alignment.
SetTextVerticalAlignment(TextAlignmentType value)Gets or sets the text vertical alignment of text.
SetWidth(int32_t value)Gets or sets the width of frame in units of 1/4000 of the chart area.
SetX(int32_t value)Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
SetY(int32_t value)Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
~ChartFrame()Destructor.
~ChartTextFrame()Destructor.
~DataLabels()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
    //Set the DataLabels in the chart
    Workbook wb(u"chart.xlsx");
    Chart chart = wb.GetWorksheets().Get(0).GetCharts().Get(0);

    for (int i = 0; i < chart.GetNSeries().GetCount(); i++)
    {
        DataLabels datalabels = chart.GetNSeries().Get(i).GetDataLabels();
        //Set the position of DataLabels
        datalabels.SetPosition(LabelPositionType::InsideBase);
        //Show the category name in the DataLabels
        datalabels.SetShowCategoryName(true);
        //Show the value in the DataLabels
        datalabels.SetShowValue(true);
        //Not show the percentage in the DataLabels
        datalabels.SetShowPercentage(false);
        //Not show the legend key.
        datalabels.SetShowLegendKey(false);
    }

Aspose::Cells::Cleanup();

See Also