officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-legend-b3741a16.md
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
LegendPosition Position { get; set; }
Property Position As LegendPosition
| Type | Description |
|---|---|
| LegendPosition |
A LegendPosition enumeration member that specifies the position.
|
Available values:
| Name | Description |
|---|---|
| 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.
|
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;
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
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;
winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/LegendActions.cs#L38
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;
// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom;
wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/LegendActions.vb#L42
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom
winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/LegendActions.vb#L41
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom
' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Bottom
See Also