DataLabels

Inheritance: java.lang.Object, com.aspose.cells.ChartFrame, com.aspose.cells.ChartTextFrame

public class DataLabels extends ChartTextFrame

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

Example

         //Set the DataLabels in the chart
         Workbook wb = new Workbook("chart.xlsx");
         Chart chart = wb.getWorksheets().get(0).getCharts().get(0);
         DataLabels datalabels;
         for (int i = 0; i  <chart.getNSeries().getCount(); i++)
         {
             datalabels = chart.getNSeries().get(i).getDataLabels();
             //Set the position of DataLabels
             datalabels.setPosition(LabelPositionType.INSIDE_BASE);
             //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);
         }

Methods

MethodDescription
applyFont()Apply the font of the datalabels to all child nodes.
characters(int startIndex, int length)Returns a Characters object that represents a range of characters within the text.
equals(Object arg0)
getArea()Gets the Area.
getAutoScaleFont()True if the text in the object changes font size when the object size changes.
getBackground()Gets the display mode of the background
getBackgroundMode()Gets the display mode of the background
getBorder()Gets the Line.
getChart()Gets the chart to which this object belongs.
getClass()
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 the direction of text.
getFont()Gets the font of the DataLabels;
getHeight()Gets the height of frame in units of 1/4000 of the chart area.
getLinkedSource()Gets a reference to the worksheet.
getNumber()Gets the built-in number format.
getNumberFormat()Represents the format string for the DataLabels object.
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 the separator type used for the data labels on a chart.
getSeparatorValue()Gets the separator value used for the data labels on a chart.
getShadow()True if the frame has a shadow.
getShapeProperties()Gets the getShapeProperties() object.
getShapeType()Gets shape type of data label.
getShowBubbleSize()Represents a specified chart’s data label percentage value display behavior.
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.
getShowCellRange()Indicates whether showing cell range as the data labels.
getShowLegendKey()Represents a specified chart’s data label legend key display behavior.
getShowPercentage()Represents a specified chart’s data label percentage value display behavior.
getShowSeriesName()Indicates whether the series name displays for the data labels on a chart.
getShowValue()Represents a specified chart’s data label values display behavior.
getText()Gets the text of data label.
getTextDirection()Represents text reading order.
getTextFont()Gets a ChartArea.getFont() object of the specified ChartFrame object.
getTextHorizontalAlignment()Gets the text horizontal alignment.
getTextOptions()Gets the options of the text.
getTextVerticalAlignment()Gets the text vertical alignment of text.
getWidth()Gets the width of frame in units of 1/4000 of the chart area.
getX()Gets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
getY()Gets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
hashCode()
isAutoText()Indicates the text is auto generated.
isAutomaticRotation()Indicates whether the text of the chart is automatically rotated.
isAutomaticSize()Indicates whether the chart frame is automatic sized.
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.
isNeverOverlap()Indicates whether the datalabels display never overlap.
isResizeShapeToFitText()Gets whether a shape should be auto-fit to fully contain the text described within it.
isTextWrapped()Gets a value indicating whether the text is wrapped.
notify()
notifyAll()
setAutoScaleFont(boolean value)True if the text in the object changes font size when the object size changes.
setAutoText(boolean value)Indicates the text is auto generated.
setAutomaticSize(boolean value)Indicates whether the chart frame is automatic sized.
setBackground(int value)Sets the display mode of the background
setBackgroundMode(int value)Sets the display mode of the background
setDeleted(boolean value)Indicates whether this data labels is deleted.
setDirectionType(int value)Sets the direction of text.
setHeight(int value)Sets the height of frame in units of 1/4000 of the chart area.
setInnerMode(boolean value)Indicates whether the size of the plot area size includes the tick marks, and the axis labels.
setLinkedSource(String value)Sets a reference to the worksheet.
setNeverOverlap(boolean value)Indicates whether the datalabels display never overlap.
setNumber(int value)Sets the built-in number format.
setNumberFormat(String value)Represents the format string for the DataLabels object.
setNumberFormatLinked(boolean 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(int value)Represents the position of the data label.
setPositionAuto()Set position of the frame to automatic
setReadingOrder(int value)Represents text reading order.
setResizeShapeToFitText(boolean value)Sets whether a shape should be auto-fit to fully contain the text described within it.
setRotationAngle(int value)Represents text rotation angle.
setSeparatorType(int value)Sets the separator type used for the data labels on a chart.
setSeparatorValue(String value)Sets the separator value used for the data labels on a chart.
setShadow(boolean value)True if the frame has a shadow.
setShapeType(int value)Sets shape type of data label.
setShowBubbleSize(boolean value)Represents a specified chart’s data label percentage value display behavior.
setShowCategoryName(boolean 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.
setShowCellRange(boolean value)Indicates whether showing cell range as the data labels.
setShowLegendKey(boolean value)Represents a specified chart’s data label legend key display behavior.
setShowPercentage(boolean value)Represents a specified chart’s data label percentage value display behavior.
setShowSeriesName(boolean value)Indicates whether the series name displays for the data labels on a chart.
setShowValue(boolean value)Represents a specified chart’s data label values display behavior.
setText(String value)Sets the text of data label.
setTextDirection(int value)Represents text reading order.
setTextHorizontalAlignment(int value)Sets the text horizontal alignment.
setTextVerticalAlignment(int value)Sets the text vertical alignment of text.
setTextWrapped(boolean value)Sets a value indicating whether the text is wrapped.
setWidth(int value)Sets the width of frame in units of 1/4000 of the chart area.
setX(int value)Sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
setY(int value)Sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

applyFont()

public void applyFont()

Apply the font of the datalabels to all child nodes.

characters(int startIndex, int length)

public FontSetting characters(int startIndex, int length)

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

Parameters:

ParameterTypeDescription
startIndexintThe index of the start of the character.
lengthintThe number of characters.

Returns: FontSetting - Characters object.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getArea()

public Area getArea()

Gets the Area.

Returns: Area

getAutoScaleFont()

public boolean getAutoScaleFont()

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

Returns: boolean

getBackground()

public int getBackground()

Gets the display mode of the background

See BackgroundMode.

Remarks

NOTE: This member is now obsolete. Instead, please use ChartFrame.BackgroundMode property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getBackgroundMode()

public int getBackgroundMode()

Gets the display mode of the background

See BackgroundMode.

Returns: int

getBorder()

public Line getBorder()

Gets the Line.

Returns: Line

getChart()

public Chart getChart()

Gets the chart to which this object belongs.

Returns: Chart

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getDefaultHeight()

public int getDefaultHeight()

Represents height of default position

Returns: int

getDefaultWidth()

public int getDefaultWidth()

Represents width of default position

Returns: int

getDefaultX()

public int getDefaultX()

Represents x of default position

Returns: int

getDefaultY()

public int getDefaultY()

Represents y of default position

Returns: int

getDirectionType()

public int getDirectionType()

Gets the direction of text.

See ChartTextDirectionType.

Returns: int

getFont()

public Font getFont()

Gets the font of the DataLabels;

Returns: Font

getHeight()

public int getHeight()

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

Remarks

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

Returns: int

getLinkedSource()

public String getLinkedSource()

Gets a reference to the worksheet.

Returns: java.lang.String

getNumber()

public int getNumber()

Gets the built-in number format.

Returns: int

getNumberFormat()

public String getNumberFormat()

Represents the format string for the DataLabels object.

Returns: java.lang.String

getNumberFormatLinked()

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

Returns: boolean

getPosition()

public int getPosition()

Represents the position of the data label.

See LabelPositionType.

Returns: int

getReadingOrder()

public int getReadingOrder()

Represents text reading order.

See TextDirectionType.

Returns: int

getRotationAngle()

public int getRotationAngle()

Represents text rotation angle.

Remarks

0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

Returns: int

getSeparatorType()

public int getSeparatorType()

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

See DataLabelsSeparatorType.

Remarks

To set custom separator, please set the property getSeparatorType() as DataLabelsSeparatorType.CUSTOM and then specify the expected value for getSeparatorValue().

Returns: int

getSeparatorValue()

public String getSeparatorValue()

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

Returns: java.lang.String

getShadow()

public boolean getShadow()

True if the frame has a shadow.

Returns: boolean

getShapeProperties()

public ShapePropertyCollection getShapeProperties()

Gets the getShapeProperties() object.

Returns: ShapePropertyCollection

getShapeType()

public int getShapeType()

Gets shape type of data label.

See DataLabelShapeType.

Returns: int

getShowBubbleSize()

public boolean getShowBubbleSize()

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

Returns: boolean

getShowCategoryName()

public boolean 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.

Returns: boolean

getShowCellRange()

public boolean getShowCellRange()

Indicates whether showing cell range as the data labels.

Returns: boolean

getShowLegendKey()

public boolean getShowLegendKey()

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

Returns: boolean

getShowPercentage()

public boolean getShowPercentage()

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

Returns: boolean

getShowSeriesName()

public boolean getShowSeriesName()

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

Returns: boolean

getShowValue()

public boolean getShowValue()

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

Returns: boolean

getText()

public String getText()

Gets the text of data label.

Returns: java.lang.String

getTextDirection()

public int getTextDirection()

Represents text reading order.

See TextDirectionType.

Remarks

NOTE: This member is now obsolete. Instead, please use ChartTextFrame.ReadingOrder property. This property will be removed 12 months later since March 2020. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getTextFont()

public Font getTextFont()

Gets a ChartArea.getFont() object of the specified ChartFrame object.

Remarks

NOTE: This member is now obsolete. Instead, please use ChartFrame.Font property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

Returns: Font

getTextHorizontalAlignment()

public int getTextHorizontalAlignment()

Gets the text horizontal alignment.

See TextAlignmentType.

Returns: int

getTextOptions()

public TextOptions getTextOptions()

Gets the options of the text.

Returns: TextOptions

getTextVerticalAlignment()

public int getTextVerticalAlignment()

Gets the text vertical alignment of text.

See TextAlignmentType.

Returns: int

getWidth()

public int getWidth()

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

Remarks

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

Returns: int

getX()

public int getX()

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

Remarks

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

Returns: int

getY()

public int getY()

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

Remarks

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

Returns: int

hashCode()

public native int hashCode()

Returns: int

isAutoText()

public boolean isAutoText()

Indicates the text is auto generated.

Returns: boolean

isAutomaticRotation()

public boolean isAutomaticRotation()

Indicates whether the text of the chart is automatically rotated.

Returns: boolean

isAutomaticSize()

public boolean isAutomaticSize()

Indicates whether the chart frame is automatic sized.

Returns: boolean

isDefaultPosBeSet()

public boolean isDefaultPosBeSet()

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

Returns: boolean

isDeleted()

public boolean isDeleted()

Indicates whether this data labels is deleted.

Returns: boolean

isInnerMode()

public boolean 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.

Remarks

Only for Xlsx file.

Returns: boolean

isNeverOverlap()

public boolean isNeverOverlap()

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

Returns: boolean

isResizeShapeToFitText()

public boolean isResizeShapeToFitText()

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

Returns: boolean

isTextWrapped()

public boolean isTextWrapped()

Gets a value indicating whether the text is wrapped.

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setAutoScaleFont(boolean value)

public void setAutoScaleFont(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAutoText(boolean value)

public void setAutoText(boolean value)

Indicates the text is auto generated.

Parameters:

ParameterTypeDescription
valueboolean

setAutomaticSize(boolean value)

public void setAutomaticSize(boolean value)

Indicates whether the chart frame is automatic sized.

Parameters:

ParameterTypeDescription
valueboolean

setBackground(int value)

public void setBackground(int value)

Sets the display mode of the background

See BackgroundMode.

Remarks

NOTE: This member is now obsolete. Instead, please use ChartFrame.BackgroundMode property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setBackgroundMode(int value)

public void setBackgroundMode(int value)

Sets the display mode of the background

See BackgroundMode.

Parameters:

ParameterTypeDescription
valueint

setDeleted(boolean value)

public void setDeleted(boolean value)

Indicates whether this data labels is deleted.

Parameters:

ParameterTypeDescription
valueboolean

setDirectionType(int value)

public void setDirectionType(int value)

Sets the direction of text.

See ChartTextDirectionType.

Parameters:

ParameterTypeDescription
valueint

setHeight(int value)

public void setHeight(int value)

Sets the height of frame in units of 1/4000 of the chart area.

Remarks

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

Parameters:

ParameterTypeDescription
valueint

setInnerMode(boolean value)

public void setInnerMode(boolean 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.

Remarks

Only for Xlsx file.

Parameters:

ParameterTypeDescription
valueboolean

setLinkedSource(String value)

public void setLinkedSource(String value)

Sets a reference to the worksheet.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setNeverOverlap(boolean value)

public void setNeverOverlap(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setNumber(int value)

public void setNumber(int value)

Sets the built-in number format.

Parameters:

ParameterTypeDescription
valueint

setNumberFormat(String value)

public void setNumberFormat(String value)

Represents the format string for the DataLabels object.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setNumberFormatLinked(boolean value)

public void setNumberFormatLinked(boolean 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).

Parameters:

ParameterTypeDescription
valueboolean

setPosition(int value)

public void setPosition(int value)

Represents the position of the data label.

See LabelPositionType.

Parameters:

ParameterTypeDescription
valueint

setPositionAuto()

public void setPositionAuto()

Set position of the frame to automatic

setReadingOrder(int value)

public void setReadingOrder(int value)

Represents text reading order.

See TextDirectionType.

Parameters:

ParameterTypeDescription
valueint

setResizeShapeToFitText(boolean value)

public void setResizeShapeToFitText(boolean value)

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.

Parameters:

ParameterTypeDescription
valueboolean

setRotationAngle(int value)

public void setRotationAngle(int value)

Represents text rotation angle.

Remarks

0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

Parameters:

ParameterTypeDescription
valueint

setSeparatorType(int value)

public void setSeparatorType(int value)

Sets the separator type used for the data labels on a chart.

See DataLabelsSeparatorType.

Remarks

To set custom separator, please set the property getSeparatorType() as DataLabelsSeparatorType.CUSTOM and then specify the expected value for getSeparatorValue().

Parameters:

ParameterTypeDescription
valueint

setSeparatorValue(String value)

public void setSeparatorValue(String value)

Sets the separator value used for the data labels on a chart.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setShadow(boolean value)

public void setShadow(boolean value)

True if the frame has a shadow.

Parameters:

ParameterTypeDescription
valueboolean

setShapeType(int value)

public void setShapeType(int value)

Sets shape type of data label.

See DataLabelShapeType.

Parameters:

ParameterTypeDescription
valueint

setShowBubbleSize(boolean value)

public void setShowBubbleSize(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setShowCategoryName(boolean value)

public void setShowCategoryName(boolean 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.

Parameters:

ParameterTypeDescription
valueboolean

setShowCellRange(boolean value)

public void setShowCellRange(boolean value)

Indicates whether showing cell range as the data labels.

Parameters:

ParameterTypeDescription
valueboolean

setShowLegendKey(boolean value)

public void setShowLegendKey(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setShowPercentage(boolean value)

public void setShowPercentage(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setShowSeriesName(boolean value)

public void setShowSeriesName(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setShowValue(boolean value)

public void setShowValue(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setText(String value)

public void setText(String value)

Sets the text of data label.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTextDirection(int value)

public void setTextDirection(int value)

Represents text reading order.

See TextDirectionType.

Remarks

NOTE: This member is now obsolete. Instead, please use ChartTextFrame.ReadingOrder property. This property will be removed 12 months later since March 2020. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setTextHorizontalAlignment(int value)

public void setTextHorizontalAlignment(int value)

Sets the text horizontal alignment.

See TextAlignmentType.

Parameters:

ParameterTypeDescription
valueint

setTextVerticalAlignment(int value)

public void setTextVerticalAlignment(int value)

Sets the text vertical alignment of text.

See TextAlignmentType.

Parameters:

ParameterTypeDescription
valueint

setTextWrapped(boolean value)

public void setTextWrapped(boolean value)

Sets a value indicating whether the text is wrapped.

Parameters:

ParameterTypeDescription
valueboolean

setWidth(int value)

public void setWidth(int value)

Sets the width of frame in units of 1/4000 of the chart area.

Remarks

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

Parameters:

ParameterTypeDescription
valueint

setX(int value)

public void setX(int value)

Sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.

Remarks

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

Parameters:

ParameterTypeDescription
valueint

setY(int value)

public void setY(int value)

Sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.

Remarks

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

Parameters:

ParameterTypeDescription
valueint

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int