ChartLegendPosition Property

Specifies the position of the legend on a chart. Default value is Right.

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

Syntax

public LegendPosition Position { get; set; }

Property Value

Type: LegendPosition

Examples

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 shape = builder.InsertChart(ChartType.Line, 450, 300);

// Get its legend
ChartLegend legend = shape.Chart.Legend;

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

// We can move its position by setting this attribute
legend.Position = LegendPosition.TopRight;

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

See Also