Example:
workbook = Workbook() # Adding a new worksheet to the Excel object sheetIndex = workbook.getWorksheets().add() # Obtaining the reference of the newly added worksheet by passing its sheet index worksheet = workbook.getWorksheets().get(sheetIndex) # Adding a sample value to "A1" cell worksheet.getCells().get("A1").putValue(50) # Adding a sample value to "A2" cell worksheet.getCells().get("A2").putValue(100) # Adding a sample value to "A3" cell worksheet.getCells().get("A3").putValue(150) # Adding a sample value to "B1" cell worksheet.getCells().get("B1").putValue(4) # Adding a sample value to "B2" cell worksheet.getCells().get("B2").putValue(20) # Adding a sample value to "B3" cell worksheet.getCells().get("B3").putValue(50) # Adding a chart to the worksheet chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5) # Accessing the instance of the newly added chart chart = worksheet.getCharts().get(chartIndex) # Set the DataLabels in the chart for i in range(0, chart.getNSeries().getCount()): datalabels = chart.getNSeries().get(i).getDataLabels() # Set the position of DataLabels datalabels.setPosition(LabelPositionType.INSIDE_BASE) # Show the category name in the DataLabels datalabels.setCategoryNameShown(True) # Show the value in the DataLabels datalabels.setShowValue(True) # Not show the percentage in the DataLabels datalabels.setPercentageShown(False) # Not show the legend key. datalabels.setLegendKeyShown(False)
Property Getters/Setters Summary | ||
---|---|---|
method | getArea() | |
Gets the |
||
method | getAutoScaleFont() | |
method | setAutoScaleFont(value) | |
True if the text in the object changes font size when the object size changes. The default value is True. | ||
method | getBackground() | |
method | setBackground(value) | |
Gets and sets the display mode of the background The value of the property is BackgroundMode integer constant. | ||
method | getBackgroundMode() | |
method | setBackgroundMode(value) | |
Gets and sets the display mode of the background The value of the property is BackgroundMode integer constant. | ||
method | getBorder() | |
Gets the |
||
method | getChart() | |
Gets the chart to which this object belongs.
|
||
method | getDefaultHeight() | |
Represents height of default position
|
||
method | getDefaultWidth() | |
Represents width of default position
|
||
method | getDefaultX() | |
Represents x of default position
|
||
method | getDefaultY() | |
Represents y of default position
|
||
method | getDirectionType() | |
method | setDirectionType(value) | |
Gets and sets the direction of text. The value of the property is ChartTextDirectionType integer constant. | ||
method | getFont() | |
Gets the font of the DataLabels;
|
||
method | getHeight() | |
method | setHeight(value) | |
Gets or sets the height of frame in units of 1/4000 of the chart area. | ||
method | isAutomaticSize() | |
method | setAutomaticSize(value) | |
Indicates whether the chart frame is automatic sized. | ||
method | isAutoText() | |
method | setAutoText(value) | |
Indicates the text is auto generated. | ||
method | isDefaultPosBeSet() | |
Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
|
||
method | isDeleted() | |
method | setDeleted(value) | |
Indicates whether this data labels is deleted. | ||
method | isInnerMode() | |
method | setInnerMode(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. | ||
method | isNeverOverlap() | |
method | setNeverOverlap(value) | |
Indicates whether the datalabels display never overlap. (For Pie chart) | ||
method | isResizeShapeToFitText() | |
method | setResizeShapeToFitText(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. | ||
method | isTextWrapped() | |
method | setTextWrapped(value) | |
Gets or sets a value indicating whether the text is wrapped. | ||
method | getLinkedSource() | |
method | setLinkedSource(value) | |
Gets and sets a reference to the worksheet. | ||
method | getNumber() | |
method | setNumber(value) | |
Gets and sets the built-in number format. | ||
method | getNumberFormat() | |
method | setNumberFormat(value) | |
Represents the format string for the DataLabels object. | ||
method | getNumberFormatLinked() | |
method | setNumberFormatLinked(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). | ||
method | getPosition() | |
method | setPosition(value) | |
Represents the position of the data label. The value of the property is LabelPositionType integer constant. | ||
method | getReadingOrder() | |
method | setReadingOrder(value) | |
Represents text reading order. The value of the property is TextDirectionType integer constant. | ||
method | getRotationAngle() | |
method | setRotationAngle(value) | |
Represents text rotation angle. | ||
method | getSeparator() | |
method | setSeparator(value) | |
Gets or sets the separator type used for the data labels on a chart. The value of the property is DataLablesSeparatorType integer constant. | ||
method | getSeparatorType() | |
method | setSeparatorType(value) | |
Gets or sets the separator type used for the data labels on a chart. The value of the property is DataLabelsSeparatorType integer constant. | ||
method | getSeparatorValue() | |
method | setSeparatorValue(value) | |
Gets or sets the separator value used for the data labels on a chart. | ||
method | getShadow() | |
method | setShadow(value) | |
True if the frame has a shadow. | ||
method | getShapeProperties() | |
Gets the |
||
method | getShapeType() | |
method | setShapeType(value) | |
Gets or sets shape type of data label. The value of the property is DataLabelShapeType integer constant. | ||
method | getShowBubbleSize() | |
method | setShowBubbleSize(value) | |
Represents a specified chart's data label percentage value display behavior. True displays the percentage value. False to hide. | ||
method | getShowCategoryName() | |
method | setShowCategoryName(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. | ||
method | getShowCellRange() | |
method | setShowCellRange(value) | |
Indicates whether showing cell range as the data labels. | ||
method | getShowLegendKey() | |
method | setShowLegendKey(value) | |
Represents a specified chart's data label legend key display behavior. True if the data label legend key is visible. | ||
method | getShowPercentage() | |
method | setShowPercentage(value) | |
Represents a specified chart's data label percentage value display behavior. True displays the percentage value. False to hide. | ||
method | getShowSeriesName() | |
method | setShowSeriesName(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. | ||
method | getShowValue() | |
method | setShowValue(value) | |
Represents a specified chart's data label values display behavior. True displays the values. False to hide. | ||
method | getText() | |
method | setText(value) | |
Gets or sets the text of data label. | ||
method | getTextDirection() | |
method | setTextDirection(value) | |
Represents text reading order. The value of the property is TextDirectionType integer constant. | ||
method | getTextFont() | |
Gets a |
||
method | getTextHorizontalAlignment() | |
method | setTextHorizontalAlignment(value) | |
Gets and sets the text horizontal alignment. The value of the property is TextAlignmentType integer constant. | ||
method | getTextVerticalAlignment() | |
method | setTextVerticalAlignment(value) | |
Gets or sets the text vertical alignment of text. The value of the property is TextAlignmentType integer constant. | ||
method | getWidth() | |
method | setWidth(value) | |
Gets or sets the width of frame in units of 1/4000 of the chart area. | ||
method | getX() | |
method | setX(value) | |
Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area. | ||
method | getY() | |
method | setY(value) | |
Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area. |
Method Summary | ||
---|---|---|
method | characters(startIndex, length) | |
Returns a Characters object that represents a range of characters within the text.
|
||
method | setPositionAuto() | |
Set position of the frame to automatic
|
boolean isAutoText() / setAutoText(value)
int getDirectionType() / setDirectionType(value)
String getText() / setText(value)
boolean isTextWrapped() / setTextWrapped(value)
int getBackgroundMode() / setBackgroundMode(value)
boolean getShowValue() / setShowValue(value)
boolean getShowCellRange() / setShowCellRange(value)
boolean getShowPercentage() / setShowPercentage(value)
boolean getShowBubbleSize() / setShowBubbleSize(value)
boolean getShowCategoryName() / setShowCategoryName(value)
boolean getShowSeriesName() / setShowSeriesName(value)
boolean getShowLegendKey() / setShowLegendKey(value)
String getNumberFormat() / setNumberFormat(value)
int getNumber() / setNumber(value)
boolean getNumberFormatLinked() / setNumberFormatLinked(value)
int getSeparator() / setSeparator(value)
int getSeparatorType() / setSeparatorType(value)
String getSeparatorValue() / setSeparatorValue(value)
int getPosition() / setPosition(value)
boolean isNeverOverlap() / setNeverOverlap(value)
int getShapeType() / setShapeType(value)
boolean isDeleted() / setDeleted(value)
int getTextHorizontalAlignment() / setTextHorizontalAlignment(value)
int getTextVerticalAlignment() / setTextVerticalAlignment(value)
int getRotationAngle() / setRotationAngle(value)
String getLinkedSource() / setLinkedSource(value)
int getTextDirection() / setTextDirection(value)
int getReadingOrder() / setReadingOrder(value)
boolean isResizeShapeToFitText() / setResizeShapeToFitText(value)
boolean isInnerMode() / setInnerMode(value)
Font getTextFont()
boolean getAutoScaleFont() / setAutoScaleFont(value)
int getBackground() / setBackground(value)
boolean isAutomaticSize() / setAutomaticSize(value)
int getX() / setX(value)
int getY() / setY(value)
int getHeight() / setHeight(value)
int getWidth() / setWidth(value)
boolean getShadow() / setShadow(value)
ShapePropertyCollection getShapeProperties()
boolean isDefaultPosBeSet()
int getDefaultX()
int getDefaultY()
int getDefaultWidth()
int getDefaultHeight()
FontSetting characters(startIndex, length)
startIndex: int
- The index of the start of the character.length: int
- The number of characters.setPositionAuto()