public class LegendPosition
Example:
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");
Field Summary | ||
---|---|---|
static final int | NONE | |
No legend will be shown for the chart.
|
||
static final int | BOTTOM | |
Specifies that the legend shall be drawn at the bottom of the chart.
|
||
static final int | LEFT | |
Specifies that the legend shall be drawn at the left of the chart.
|
||
static final int | RIGHT | |
Specifies that the legend shall be drawn at the right of the chart.
|
||
static final int | TOP | |
Specifies that the legend shall be drawn at the top of the chart.
|
||
static final int | TOP_RIGHT | |
Specifies that the legend shall be drawn at the top right of the chart.
|
public static final int NONE
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int TOP_RIGHT