public class DataLabels extends ChartTextFrame
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);
}
| Modifier and Type | Method and Description |
|---|---|
void |
applyFont()
Apply the font of the datalabels to all child nodes.
|
Area |
getArea()
Gets the
Area. |
int |
getBackgroundMode()
Gets the display mode of the background
|
Line |
getBorder()
Gets the
Line. |
int |
getDirectionType()
Gets the direction of text.
|
Font |
getFont()
Gets the font of the DataLabels;
|
int |
getNumber()
Gets the built-in number format.
|
java.lang.String |
getNumberFormat()
Represents the format string for the DataLabels object.
|
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).
|
int |
getPosition()
Represents the position of the data label.
|
int |
getSeparatorType()
Gets the separator type used for the data labels on a chart.
|
java.lang.String |
getSeparatorValue()
Gets the separator value used for the data labels on a chart.
|
int |
getShapeType()
Gets shape type of data label.
|
boolean |
getShowBubbleSize()
Represents a specified chart's data label percentage value display behavior.
|
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.
|
boolean |
getShowCellRange()
Indicates whether showing cell range as the data labels.
|
boolean |
getShowLegendKey()
Represents a specified chart's data label legend key display behavior.
|
boolean |
getShowPercentage()
Represents a specified chart's data label percentage value display behavior.
|
boolean |
getShowSeriesName()
Indicates whether the series name displays for the data labels on a chart.
|
boolean |
getShowValue()
Represents a specified chart's data label values display behavior.
|
java.lang.String |
getText()
Gets the text of data label.
|
boolean |
isAutoText()
Indicates the text is auto generated.
|
boolean |
isNeverOverlap()
Indicates whether the datalabels display never overlap.
|
boolean |
isTextWrapped()
Gets a value indicating whether the text is wrapped.
|
void |
setAutoText(boolean value)
Indicates the text is auto generated.
|
void |
setBackgroundMode(int value)
Sets the display mode of the background
|
void |
setDirectionType(int value)
Sets the direction of text.
|
void |
setNeverOverlap(boolean value)
Indicates whether the datalabels display never overlap.
|
void |
setNumber(int value)
Sets the built-in number format.
|
void |
setNumberFormat(java.lang.String value)
Represents the format string for the DataLabels object.
|
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).
|
void |
setPosition(int value)
Represents the position of the data label.
|
void |
setSeparatorType(int value)
Sets the separator type used for the data labels on a chart.
|
void |
setSeparatorValue(java.lang.String value)
Sets the separator value used for the data labels on a chart.
|
void |
setShapeType(int value)
Sets shape type of data label.
|
void |
setShowBubbleSize(boolean value)
Represents a specified chart's data label percentage value display behavior.
|
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.
|
void |
setShowCellRange(boolean value)
Indicates whether showing cell range as the data labels.
|
void |
setShowLegendKey(boolean value)
Represents a specified chart's data label legend key display behavior.
|
void |
setShowPercentage(boolean value)
Represents a specified chart's data label percentage value display behavior.
|
void |
setShowSeriesName(boolean value)
Indicates whether the series name displays for the data labels on a chart.
|
void |
setShowValue(boolean value)
Represents a specified chart's data label values display behavior.
|
void |
setText(java.lang.String value)
Sets the text of data label.
|
void |
setTextWrapped(boolean value)
Sets a value indicating whether the text is wrapped.
|
characters, getLinkedSource, getReadingOrder, getRotationAngle, getTextDirection, getTextHorizontalAlignment, getTextVerticalAlignment, isAutomaticRotation, isDeleted, isResizeShapeToFitText, setDeleted, setLinkedSource, setReadingOrder, setResizeShapeToFitText, setRotationAngle, setTextDirection, setTextHorizontalAlignment, setTextVerticalAlignmentgetAutoScaleFont, getBackground, getChart, getDefaultHeight, getDefaultHeightRatioToChart, getDefaultWidth, getDefaultWidthRatioToChart, getDefaultX, getDefaultXRatioToChart, getDefaultY, getDefaultYRatioToChart, getHeight, getHeightPixel, getHeightRatioToChart, getShadow, getShapeProperties, getTextFont, getTextOptions, getWidth, getWidthPixel, getWidthRatioToChart, getX, getXPixel, getXRatioToChart, getY, getYPixel, getYRatioToChart, isAutomaticSize, isDefaultPosBeSet, isInnerMode, setAutomaticSize, setAutoScaleFont, setBackground, setHeight, setHeightPixel, setHeightRatioToChart, setInnerMode, setPositionAuto, setShadow, setWidth, setWidthPixel, setWidthRatioToChart, setX, setXPixel, setXRatioToChart, setY, setYPixel, setYRatioToChartpublic Line getBorder()
Line.getBorder in class ChartFramepublic Area getArea()
Area.getArea in class ChartFramepublic boolean isAutoText()
isAutoText in class ChartTextFramepublic void setAutoText(boolean value)
setAutoText in class ChartTextFramepublic int getDirectionType()
getDirectionType in class ChartTextFramepublic void setDirectionType(int value)
setDirectionType in class ChartTextFramepublic java.lang.String getText()
getText in class ChartTextFramepublic void setText(java.lang.String value)
setText in class ChartTextFramepublic boolean isTextWrapped()
isTextWrapped in class ChartTextFramepublic void setTextWrapped(boolean value)
setTextWrapped in class ChartTextFramepublic int getBackgroundMode()
See BackgroundMode.
getBackgroundMode in class ChartFramepublic void setBackgroundMode(int value)
See BackgroundMode.
setBackgroundMode in class ChartFramepublic boolean getShowValue()
public void setShowValue(boolean value)
public boolean getShowCellRange()
public void setShowCellRange(boolean value)
public boolean getShowPercentage()
public void setShowPercentage(boolean value)
public boolean getShowBubbleSize()
public void setShowBubbleSize(boolean value)
public boolean getShowCategoryName()
public void setShowCategoryName(boolean value)
public boolean getShowSeriesName()
public void setShowSeriesName(boolean value)
public boolean getShowLegendKey()
public void setShowLegendKey(boolean value)
public java.lang.String getNumberFormat()
public void setNumberFormat(java.lang.String value)
public int getNumber()
public void setNumber(int value)
public boolean getNumberFormatLinked()
public void setNumberFormatLinked(boolean value)
public void applyFont()
public Font getFont()
getFont in class ChartFramepublic int getSeparatorType()
Remarks
To set custom separator, please set the propertygetSeparatorType() as DataLabelsSeparatorType.CUSTOM and then specify the expected value for getSeparatorValue().public void setSeparatorType(int value)
Remarks
To set custom separator, please set the propertygetSeparatorType() as DataLabelsSeparatorType.CUSTOM and then specify the expected value for getSeparatorValue().public java.lang.String getSeparatorValue()
public void setSeparatorValue(java.lang.String value)
public int getPosition()
See LabelPositionType.
public void setPosition(int value)
See LabelPositionType.
public boolean isNeverOverlap()
public void setNeverOverlap(boolean value)
public int getShapeType()
See DataLabelShapeType.
public void setShapeType(int value)
See DataLabelShapeType.
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.