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

// Insert a line graph
Shape chartShape = builder.insertChart(ChartType.LINE, 450.0, 300.0);
Chart chart = chartShape.getChart();

// Get its legend
ChartLegend legend = chart.getLegend();

// By default, other elements of a chart will not overlap with its legend
Assert.assertFalse(legend.getOverlay());

// We can move its position by setting this attribute
legend.setPosition(LegendPosition.TOP_RIGHT);

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.