DataLabels

DataLabels class

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

class DataLabels extends ChartTextFrame;

Constructors

NameDescription
constructor(ChartTextFrame)Constructs from a parent object convertible to this.

Methods

MethodDescription
getBorder()Gets the border.
getArea()Gets the area.
isAutoText()Indicates the text is auto generated.
setIsAutoText(boolean)Indicates the text is auto generated.
getDirectionType()Gets and sets the direction of text.
setDirectionType(ChartTextDirectionType)Gets and sets the direction of text.
getText()Gets or sets the text of data label.
setText(string)Gets or sets the text of data label.
isTextWrapped()Gets or sets a value indicating whether the text is wrapped.
setIsTextWrapped(boolean)Gets or sets a value indicating whether the text is wrapped.
getBackgroundMode()Gets and sets the display mode of the background
setBackgroundMode(BackgroundMode)Gets and sets the display mode of the background
getShowValue()Represents a specified chart’s data label values display behavior. True displays the values. False to hide.
setShowValue(boolean)Represents a specified chart’s data label values display behavior. True displays the values. False to hide.
getShowCellRange()Indicates whether showing cell range as the data labels.
setShowCellRange(boolean)Indicates whether showing cell range as the data labels.
getShowPercentage()Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
setShowPercentage(boolean)Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
getShowBubbleSize()Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.
setShowBubbleSize(boolean)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.
setShowCategoryName(boolean)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.
getShowSeriesName()Indicates whether the series name displays for the data labels on a chart. True to show the series name. False to hide.
setShowSeriesName(boolean)Indicates whether the series name displays for the data labels on a chart. True to show the series name. False to hide.
getShowLegendKey()Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.
setShowLegendKey(boolean)Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.
get_NumberFormat()Represents the format string for the DataLabels object.
setNumberFormat(string)Represents the format string for the DataLabels object.
getNumber()Gets and sets the built-in number format.
setNumber(number)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).
setNumberFormatLinked(boolean)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).
getFont()Gets the font of the DataLabels;
getSeparatorType()Gets or sets the separator type used for the data labels on a chart.
setSeparatorType(DataLabelsSeparatorType)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.
setSeparatorValue(string)Gets or sets the separator value used for the data labels on a chart.
getPosition()Represents the position of the data label.
setPosition(LabelPositionType)Represents the position of the data label.
isNeverOverlap()Indicates whether the datalabels display never overlap. (For Pie chart)
setIsNeverOverlap(boolean)Indicates whether the datalabels display never overlap. (For Pie chart)
getShapeType()Gets or sets shape type of data label.
setShapeType(DataLabelShapeType)Gets or sets shape type of data label.
applyFont()Apply the font of the datalabels to all child nodes.
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.
setIsInnerMode(boolean)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.
getShadow()True if the frame has a shadow.
setShadow(boolean)True if the frame has a shadow.
getShapeProperties()Gets the ShapeProperties object.
isDefaultPosBeSet()Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
getDefaultX()Represents x of default position
getDefaultY()Represents y of default position
getDefaultWidth()Represents width of default position
getDefaultHeight()Represents height of default position
setPositionAuto()Set position of the frame to automatic
isDeleted()Indicates whether this data labels is deleted.
setIsDeleted(boolean)Indicates whether this data labels is deleted.
getTextHorizontalAlignment()Gets and sets the text horizontal alignment.
setTextHorizontalAlignment(TextAlignmentType)Gets and sets the text horizontal alignment.
getTextVerticalAlignment()Gets or sets the text vertical alignment of text.
setTextVerticalAlignment(TextAlignmentType)Gets or sets the text vertical alignment of text.
getRotationAngle()Represents text rotation angle.
setRotationAngle(number)Represents text rotation angle.
isAutomaticRotation()Indicates whether the text of the chart is automatically rotated.
getReadingOrder()Represents text reading order.
setReadingOrder(TextDirectionType)Represents text reading order.
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.
setIsResizeShapeToFitText(boolean)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.
characters(number, number)Returns a Characters object that represents a range of characters within the text.
getTextOptions()Gets and sets the options of the text.
getAutoScaleFont()True if the text in the object changes font size when the object size changes. The default value is True.
setAutoScaleFont(boolean)True if the text in the object changes font size when the object size changes. The default value is True.
isAutomaticSize()Indicates whether the chart frame is automatic sized.
setIsAutomaticSize(boolean)Indicates whether the chart frame is automatic sized.
getX()Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
setX(number)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.
setY(number)Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
getHeight()Gets or sets the height of frame in units of 1/4000 of the chart area.
setHeight(number)Gets or sets the height of frame in units of 1/4000 of the chart area.
getWidth()Gets or sets the width of frame in units of 1/4000 of the chart area.
setWidth(number)Gets or sets the width of frame in units of 1/4000 of the chart area.
getLinkedSource()Gets and sets a reference to the worksheet.
setLinkedSource(string)Gets and sets a reference to the worksheet.

constructor(ChartTextFrame)

Constructs from a parent object convertible to this.

constructor(obj: ChartTextFrame);

Parameters:

ParameterTypeDescription
objChartTextFrameThe parent object.

getBorder()

Gets the border.

getBorder() : Line;

Returns

Line

getArea()

Gets the area.

getArea() : Area;

Returns

Area

isAutoText()

Indicates the text is auto generated.

isAutoText() : boolean;

setIsAutoText(boolean)

Indicates the text is auto generated.

setIsAutoText(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getDirectionType()

Gets and sets the direction of text.

getDirectionType() : ChartTextDirectionType;

Returns

ChartTextDirectionType

setDirectionType(ChartTextDirectionType)

Gets and sets the direction of text.

setDirectionType(value: ChartTextDirectionType) : void;

Parameters:

ParameterTypeDescription
valueChartTextDirectionTypeThe value to set.

getText()

Gets or sets the text of data label.

getText() : string;

setText(string)

Gets or sets the text of data label.

setText(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

isTextWrapped()

Gets or sets a value indicating whether the text is wrapped.

isTextWrapped() : boolean;

setIsTextWrapped(boolean)

Gets or sets a value indicating whether the text is wrapped.

setIsTextWrapped(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getBackgroundMode()

Gets and sets the display mode of the background

getBackgroundMode() : BackgroundMode;

Returns

BackgroundMode

setBackgroundMode(BackgroundMode)

Gets and sets the display mode of the background

setBackgroundMode(value: BackgroundMode) : void;

Parameters:

ParameterTypeDescription
valueBackgroundModeThe value to set.

getShowValue()

Represents a specified chart’s data label values display behavior. True displays the values. False to hide.

getShowValue() : boolean;

setShowValue(boolean)

Represents a specified chart’s data label values display behavior. True displays the values. False to hide.

setShowValue(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowCellRange()

Indicates whether showing cell range as the data labels.

getShowCellRange() : boolean;

setShowCellRange(boolean)

Indicates whether showing cell range as the data labels.

setShowCellRange(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowPercentage()

Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.

getShowPercentage() : boolean;

setShowPercentage(boolean)

Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.

setShowPercentage(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowBubbleSize()

Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.

getShowBubbleSize() : boolean;

setShowBubbleSize(boolean)

Represents a specified chart’s data label percentage value display behavior. True displays the percentage value. False to hide.

setShowBubbleSize(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

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.

getShowCategoryName() : boolean;

setShowCategoryName(boolean)

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.

setShowCategoryName(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowSeriesName()

Indicates whether the series name displays for the data labels on a chart. True to show the series name. False to hide.

getShowSeriesName() : boolean;

setShowSeriesName(boolean)

Indicates whether the series name displays for the data labels on a chart. True to show the series name. False to hide.

setShowSeriesName(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowLegendKey()

Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.

getShowLegendKey() : boolean;

setShowLegendKey(boolean)

Represents a specified chart’s data label legend key display behavior. True if the data label legend key is visible.

setShowLegendKey(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

get_NumberFormat()

Represents the format string for the DataLabels object.

get_NumberFormat() : string;

setNumberFormat(string)

Represents the format string for the DataLabels object.

setNumberFormat(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getNumber()

Gets and sets the built-in number format.

getNumber() : number;

setNumber(number)

Gets and sets the built-in number format.

setNumber(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

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).

getNumberFormatLinked() : boolean;

setNumberFormatLinked(boolean)

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).

setNumberFormatLinked(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getFont()

Gets the font of the DataLabels;

getFont() : Font;

Returns

Font

getSeparatorType()

Gets or sets the separator type used for the data labels on a chart.

getSeparatorType() : DataLabelsSeparatorType;

Returns

DataLabelsSeparatorType

Remarks

To set custom separator, please set the property DataLabels.SeparatorType as DataLabels.SeparatorType and then specify the expected value for DataLabels.SeparatorType.

setSeparatorType(DataLabelsSeparatorType)

Gets or sets the separator type used for the data labels on a chart.

setSeparatorType(value: DataLabelsSeparatorType) : void;

Parameters:

ParameterTypeDescription
valueDataLabelsSeparatorTypeThe value to set.

Remarks

To set custom separator, please set the property DataLabels.SeparatorType as DataLabels.SeparatorType and then specify the expected value for DataLabels.SeparatorType.

getSeparatorValue()

Gets or sets the separator value used for the data labels on a chart.

getSeparatorValue() : string;

setSeparatorValue(string)

Gets or sets the separator value used for the data labels on a chart.

setSeparatorValue(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getPosition()

Represents the position of the data label.

getPosition() : LabelPositionType;

Returns

LabelPositionType

setPosition(LabelPositionType)

Represents the position of the data label.

setPosition(value: LabelPositionType) : void;

Parameters:

ParameterTypeDescription
valueLabelPositionTypeThe value to set.

isNeverOverlap()

Indicates whether the datalabels display never overlap. (For Pie chart)

isNeverOverlap() : boolean;

setIsNeverOverlap(boolean)

Indicates whether the datalabels display never overlap. (For Pie chart)

setIsNeverOverlap(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShapeType()

Gets or sets shape type of data label.

getShapeType() : DataLabelShapeType;

Returns

DataLabelShapeType

setShapeType(DataLabelShapeType)

Gets or sets shape type of data label.

setShapeType(value: DataLabelShapeType) : void;

Parameters:

ParameterTypeDescription
valueDataLabelShapeTypeThe value to set.

applyFont()

Apply the font of the datalabels to all child nodes.

applyFont() : void;

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.

isInnerMode() : boolean;

Remarks

Only for Xlsx file.

setIsInnerMode(boolean)

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.

setIsInnerMode(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for Xlsx file.

getShadow()

True if the frame has a shadow.

getShadow() : boolean;

setShadow(boolean)

True if the frame has a shadow.

setShadow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShapeProperties()

Gets the ShapeProperties object.

getShapeProperties() : ShapePropertyCollection;

Returns

ShapePropertyCollection

isDefaultPosBeSet()

Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.

isDefaultPosBeSet() : boolean;

getDefaultX()

Represents x of default position

getDefaultX() : number;

getDefaultY()

Represents y of default position

getDefaultY() : number;

getDefaultWidth()

Represents width of default position

getDefaultWidth() : number;

getDefaultHeight()

Represents height of default position

getDefaultHeight() : number;

setPositionAuto()

Set position of the frame to automatic

setPositionAuto() : void;

isDeleted()

Indicates whether this data labels is deleted.

isDeleted() : boolean;

setIsDeleted(boolean)

Indicates whether this data labels is deleted.

setIsDeleted(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getTextHorizontalAlignment()

Gets and sets the text horizontal alignment.

getTextHorizontalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setTextHorizontalAlignment(TextAlignmentType)

Gets and sets the text horizontal alignment.

setTextHorizontalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

getTextVerticalAlignment()

Gets or sets the text vertical alignment of text.

getTextVerticalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setTextVerticalAlignment(TextAlignmentType)

Gets or sets the text vertical alignment of text.

setTextVerticalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

getRotationAngle()

Represents text rotation angle.

getRotationAngle() : number;

Remarks


0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

setRotationAngle(number)

Represents text rotation angle.

setRotationAngle(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks


0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

isAutomaticRotation()

Indicates whether the text of the chart is automatically rotated.

isAutomaticRotation() : boolean;

getReadingOrder()

Represents text reading order.

getReadingOrder() : TextDirectionType;

Returns

TextDirectionType

setReadingOrder(TextDirectionType)

Represents text reading order.

setReadingOrder(value: TextDirectionType) : void;

Parameters:

ParameterTypeDescription
valueTextDirectionTypeThe value to set.

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.

isResizeShapeToFitText() : boolean;

setIsResizeShapeToFitText(boolean)

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.

setIsResizeShapeToFitText(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

characters(number, number)

Returns a Characters object that represents a range of characters within the text.

characters(startIndex: number, length: number) : FontSetting;

Parameters:

ParameterTypeDescription
startIndexnumberThe index of the start of the character.
lengthnumberThe number of characters.

Returns

Characters object.

getTextOptions()

Gets and sets the options of the text.

getTextOptions() : TextOptions;

Returns

TextOptions

getAutoScaleFont()

True if the text in the object changes font size when the object size changes. The default value is True.

getAutoScaleFont() : boolean;

setAutoScaleFont(boolean)

True if the text in the object changes font size when the object size changes. The default value is True.

setAutoScaleFont(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

isAutomaticSize()

Indicates whether the chart frame is automatic sized.

isAutomaticSize() : boolean;

setIsAutomaticSize(boolean)

Indicates whether the chart frame is automatic sized.

setIsAutomaticSize(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getX()

Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.

getX() : number;

Remarks

How to convert units of 1/4000 to pixels? X In Pixels = X * Chart.ChartObject.Width / 4000;

setX(number)

Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.

setX(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

How to convert units of 1/4000 to pixels? X In Pixels = X * Chart.ChartObject.Width / 4000;

getY()

Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.

getY() : number;

Remarks

How to convert units of 1/4000 to pixels? Y In Pixels = Y * Chart.ChartObject.Height / 4000;

setY(number)

Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.

setY(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

How to convert units of 1/4000 to pixels? Y In Pixels = Y * Chart.ChartObject.Height / 4000;

getHeight()

Gets or sets the height of frame in units of 1/4000 of the chart area.

getHeight() : number;

Remarks

How to convert units of 1/4000 to pixels? Height In Pixels = Y * Chart.ChartObject.Height / 4000;

setHeight(number)

Gets or sets the height of frame in units of 1/4000 of the chart area.

setHeight(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

How to convert units of 1/4000 to pixels? Height In Pixels = Y * Chart.ChartObject.Height / 4000;

getWidth()

Gets or sets the width of frame in units of 1/4000 of the chart area.

getWidth() : number;

Remarks

How to convert units of 1/4000 to pixels? Width In Pixels = Width * Chart.ChartObject.Height / 4000;

setWidth(number)

Gets or sets the width of frame in units of 1/4000 of the chart area.

setWidth(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

How to convert units of 1/4000 to pixels? Width In Pixels = Width * Chart.ChartObject.Height / 4000;

getLinkedSource()

Gets and sets a reference to the worksheet.

getLinkedSource() : string;

setLinkedSource(string)

Gets and sets a reference to the worksheet.

setLinkedSource(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.