com.aspose.words
Class ChartLegend

java.lang.Object
    extended by com.aspose.words.ChartLegend
All Implemented Interfaces:
java.lang.Cloneable

public class ChartLegend 
extends java.lang.Object

Represents chart legend properties.

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

Constructor Summary
ChartLegend()
          
 
Property Getters/Setters Summary
booleangetOverlay()
voidsetOverlay(boolean value)
           Determines whether other chart elements shall be allowed to overlap legend. Default value is false.
intgetPosition()
voidsetPosition(int value)
           Specifies the position of the legend on a chart. Default value is LegendPosition.RIGHT. The value of the property is LegendPosition integer constant.
 

Constructor Detail

ChartLegend

public ChartLegend()

Property Getters/Setters Detail

getOverlay/setOverlay

public boolean getOverlay() / public void setOverlay(boolean value)
Determines whether other chart elements shall be allowed to overlap legend. Default value is false.

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

getPosition/setPosition

public int getPosition() / public void setPosition(int value)
Specifies the position of the legend on a chart. Default value is LegendPosition.RIGHT. The value of the property is LegendPosition integer constant.

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

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.