LegendPosition Enumeration

Specifies the possible positions for a chart legend.

Namespace:  Aspose.Words.Drawing.Charts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 22.1.0

ExpandedSyntax

public enum LegendPosition

ExpandedMembers

  Member nameValueDescription
None0 No legend will be shown for the chart.
Bottom1 Specifies that the legend shall be drawn at the bottom of the chart.
Left2 Specifies that the legend shall be drawn at the left of the chart.
Right3 Specifies that the legend shall be drawn at the right of the chart.
Top4 Specifies that the legend shall be drawn at the top of the chart.
TopRight5 Specifies that the legend shall be drawn at the top right of the chart.

ExpandedExamples

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, 300);
Chart chart = shape.Chart;

Assert.AreEqual(3, chart.Series.Count);
Assert.AreEqual("Series 1", chart.Series[0].Name);
Assert.AreEqual("Series 2", chart.Series[1].Name);
Assert.AreEqual("Series 3", chart.Series[2].Name);

// Move the chart's legend to the top right corner.
ChartLegend legend = chart.Legend;
legend.Position = LegendPosition.TopRight;

// Give other chart elements, such as the graph, more room by allowing them to overlap the legend.
legend.Overlay = true;

doc.Save(ArtifactsDir + "Charts.ChartLegend.docx");

ExpandedSee Also