Back to Devexpress

Legend.Position Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-legend-b3741a16.md

latest5.3 KB
Original Source

Legend.Position Property

Gets or sets the position of the legend on the chart.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
LegendPosition Position { get; set; }
vb
Property Position As LegendPosition

Property Value

TypeDescription
LegendPosition

A LegendPosition enumeration member that specifies the position.

|

Available values:

NameDescription
Bottom

Below the chart.

| | Left |

On the left of the chart.

| | Right |

On the right of the chart.

| | Top |

Above the chart.

| | TopRight |

In the upper right corner.

|

Example

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:F6"]);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B2:F6"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom

The following code snippets (auto-collected from DevExpress Examples) contain references to the Position property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/LegendActions.cs#L38

csharp
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/LegendActions.cs#L38

csharp
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/LegendActions.cs#L41

csharp
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/LegendActions.vb#L42

vb
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/LegendActions.vb#L41

vb
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/LegendActions.vb#L42

vb
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom

See Also

Legend Interface

Legend Members

DevExpress.Spreadsheet.Charts Namespace