com.aspose.words

Class LegendPosition

  • java.lang.Object
    • com.aspose.words.LegendPosition
public class LegendPosition 
extends java.lang.Object

Utility class containing constants. Specifies the possible positions for a chart legend.

Example:

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");

Field Summary
static final intNONE = 0
No legend will be shown for the chart.
static final intBOTTOM = 1
Specifies that the legend shall be drawn at the bottom of the chart.
static final intLEFT = 2
Specifies that the legend shall be drawn at the left of the chart.
static final intRIGHT = 3
Specifies that the legend shall be drawn at the right of the chart.
static final intTOP = 4
Specifies that the legend shall be drawn at the top of the chart.
static final intTOP_RIGHT = 5
Specifies that the legend shall be drawn at the top right of the chart.
 

    • Field Detail

      • NONE = 0

        public static final int NONE
        No legend will be shown for the chart.
      • BOTTOM = 1

        public static final int BOTTOM
        Specifies that the legend shall be drawn at the bottom of the chart.
      • LEFT = 2

        public static final int LEFT
        Specifies that the legend shall be drawn at the left of the chart.
      • RIGHT = 3

        public static final int RIGHT
        Specifies that the legend shall be drawn at the right of the chart.
      • TOP = 4

        public static final int TOP
        Specifies that the legend shall be drawn at the top of the chart.
      • TOP_RIGHT = 5

        public static final int TOP_RIGHT
        Specifies that the legend shall be drawn at the top right of the chart.