Encapsulates the object that represents the chart legend.
Example:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
cells.get(0,1).putValue("Income");
cells.get(1,0).putValue("Company A");
cells.get(2,0).putValue("Company B");
cells.get(3,0).putValue("Company C");
cells.get(1,1).putValue(10000);
cells.get(2,1).putValue(20000);
cells.get(3,1).putValue(30000);
int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 9, 9, 21, 15);
Chart chart = sheet.getCharts().get(chartIndex);
chart.setChartDataRange("A1:B4", true);
//Set Legend's width and height
Legend legend = chart.getLegend();
//Legend is at right side of chart by default.
//If the legend is at left or right side of the chart, setting Legend.X property will not take effect.
//If the legend is at top or bottom side of the chart, setting Legend.Y property will not take effect.
legend.setY(1500);
legend.setWidth(50);
legend.setHeight(50);
//Set legend's position
legend.setPosition(LegendPositionType.LEFT);
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.
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.
Gets a collection of all the LegendEntry objects in the specified chart legend.
Setting the legend entries of the surface chart is not supported.
So it will return null if the chart type is surface chart type.
public int getPosition() / public void setPosition(int value)
Gets or sets the legend position type.
The value of the property is LegendPositionType integer constant. Default position is right. If the legend is at left or right side of the chart, setting Legend.X property will not take effect. If the legend is at top or bottom side of the chart, setting Legend.Y property will not take effect.
Gets a collection of all the LegendEntry objects in the specified chart legend.
Setting the legend entries of the surface chart is not supported.
So it will return null if the chart type is surface chart type.
getLegendEntriesLabels
public java.util.ArrayList getLegendEntriesLabels()
Gets the labels of the legend entries after call Chart.Calculate() method.
isOverLay/setOverLay
public boolean isOverLay() / public void setOverLay(boolean value)
Gets or sets whether other chart elements shall be allowed to overlap this chart element.
public int getTextDirection() / public void setTextDirection(int value)
Represents text reading order.
The value of the property is TextDirectionType integer constant.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.
public boolean isResizeShapeToFitText() / public void setResizeShapeToFitText(boolean 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.
public boolean isInnerMode() / 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.
Only for Xlsx file.
Gets a Font object of the specified ChartFrame object.
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.
public int getBackground() / public void setBackground(int value)
Gets and sets the display mode of the background
The value of the property is BackgroundMode integer constant.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.
Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
How to convert units of 1/4000 to pixels?
X In Pixels = X * Chart.ChartObject.Width / 4000;
Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.
How to convert units of 1/4000 to pixels?
Y In Pixels = Y * Chart.ChartObject.Height / 4000;
public int getHeight() / public void setHeight(int value)
Gets or sets the height of frame in units of 1/4000 of the chart area.
How to convert units of 1/4000 to pixels?
Height In Pixels = Y * Chart.ChartObject.Height / 4000;
public int getWidth() / public void setWidth(int value)
Gets or sets the width of frame in units of 1/4000 of the chart area.
How to convert units of 1/4000 to pixels?
Width In Pixels = Width * Chart.ChartObject.Height / 4000;