LegendBase Class
The base class for chart legends.
Declaration
public abstract class LegendBase extends ChartElement
Remarks
Call the Chart.getLegend() method to access the legend of a chart. To specify the legend background and border, call LegendBase.setFill(value) and LegendBase.setOutlineStyle(value) methods.
The LegendEx class derives from the LegendBase class and contains legend settings for chart types introduced in Microsoft Excel 2016.
Refer to the following help topic for additional information: Customize Chart Legends — Presentation API for Java.
Inherited Members
Inheritance
Methods
deepClone() Method
Returns a deep copy of this LegendBase instance.
Declaration
public LegendBase deepClone()
Returns
| Type | Description |
|---|---|
LegendBase |
A deep copy of this |
getAllowOverlapChart() Method
Returns whether the legend can overlap the plot area.
Declaration
public boolean getAllowOverlapChart()
Returns
| Type | Description |
|---|---|
| boolean |
|
getPosition() Method
Returns the legend position in the chart.
Declaration
public LegendPositionType getPosition()
Returns
| Type | Description |
|---|---|
| LegendPositionType | The legend position. |
getTextProperties() Method
Returns text formatting settings of the legend.
Declaration
public TextProperties getTextProperties()
Returns
| Type | Description |
|---|---|
| TextProperties | Text formatting settings of the legend, or |
setAllowOverlapChart(boolean value) Method
Sets whether the legend can overlap the plot area.
Declaration
public void setAllowOverlapChart(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
If you do not call the setAllowOverlapChart(value) method, the API uses false for a new legend and the value from the document for a loaded legend.
setPosition(LegendPositionType value) Method
Sets the legend position in the chart.
Declaration
public void setPosition(LegendPositionType value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | LegendPositionType | The legend position. |
Exceptions
| Type | Description |
|---|---|
| NullPointerException | Thrown if the |
Remarks
The setPosition(value) method accepts the following values:
| Value | Description |
|---|---|
| BOTTOM | Indicates that the legend is at the bottom of the chart. |
| TOP_RIGHT | Indicates that the legend is in the upper-right corner of the chart. |
| LEFT | Indicates that the legend is on the left side of the chart. |
| RIGHT | Indicates that the legend is on the right side of the chart. |
| TOP | Indicates that the legend is at the top of the chart. |
If you do not call the setPosition(value) method, the API uses LegendPositionType.RIGHT for a new legend and the value from the document for a loaded legend.
setTextProperties(TextProperties value) Method
Sets text formatting settings of the legend.
Declaration
public void setTextProperties(TextProperties value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | TextProperties | Text formatting settings of the legend. |