ChartLegend Class
Represents chart legend properties.
Inheritance Hierarchy
SystemObject
  Aspose.Words.Drawing.ChartsChartLegend

Namespace: Aspose.Words.Drawing.Charts
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
Syntax
public class ChartLegend

The ChartLegend type exposes the following members.

Constructors
  NameDescription
Public methodChartLegend
Initializes a new instance of the ChartLegend class
Properties
  NameDescription
Public propertyCode exampleOverlay
Determines whether other chart elements shall be allowed to overlap legend. Default value is false.
Public propertyCode examplePosition
Specifies the position of the legend on a chart. Default value is Right.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
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 chartShape = builder.InsertChart(ChartType.Line, 450, 300);
Chart chart = chartShape.Chart;

// Get its legend
ChartLegend legend = 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