public class LegendPosition
extends java.lang.Object
Examples:
Shows how to edit the appearance of a chart's legend.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 300.0);
Chart chart = shape.getChart();
Assert.assertEquals(3, chart.getSeries().getCount());
Assert.assertEquals("Series 1", chart.getSeries().get(0).getName());
Assert.assertEquals("Series 2", chart.getSeries().get(1).getName());
Assert.assertEquals("Series 3", chart.getSeries().get(2).getName());
// Move the chart's legend to the top right corner.
ChartLegend legend = chart.getLegend();
legend.setPosition(LegendPosition.TOP_RIGHT);
// Give other chart elements, such as the graph, more room by allowing them to overlap the legend.
legend.setOverlay(true);
doc.save(getArtifactsDir() + "Charts.ChartLegend.docx");
| Modifier and Type | Field and Description |
|---|---|
static int |
BOTTOM
Specifies that the legend shall be drawn at the bottom of the chart.
|
static int |
LEFT
Specifies that the legend shall be drawn at the left of the chart.
|
static int |
length |
static int |
NONE
No legend will be shown for the chart.
|
static int |
RIGHT
Specifies that the legend shall be drawn at the right of the chart.
|
static int |
TOP
Specifies that the legend shall be drawn at the top of the chart.
|
static int |
TOP_RIGHT
Specifies that the legend shall be drawn at the top right of the chart.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String legendPositionName) |
static java.lang.String |
getName(int legendPosition) |
static int[] |
getValues() |
static java.lang.String |
toString(int legendPosition) |
public static int NONE
public static int BOTTOM
public static int LEFT
public static int RIGHT
public static int TOP
public static int TOP_RIGHT
public static int length