Skip to main content

LayoutPosition.SetPosition(LayoutMode, Double) Method

Specifies the exact position of the chart element.

Namespace: DevExpress.Spreadsheet.Charts

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

void SetPosition(
    LayoutMode mode,
    double value
)

Parameters

Name Type Description
mode LayoutMode

A LayoutMode enumeration member that specifies how to interpret the value.

value Double

A Double value.

Example

The code snippet below formats and positions a trendline’s label.

View Example

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

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ScatterMarkers);
chart.SelectData(worksheet["C2:F3"], ChartDataDirection.Row);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Display a polynomial trendline.
chart.Series[0].Trendlines.Add(ChartTrendlineType.Polynomial);

// Customize the trendline.
Trendline tline = chart.Series[0].Trendlines[0];
tline.DisplayEquation = true;
tline.CustomName = "Trend";
tline.DisplayRSquare = true;
tline.Outline.SetSolidFill(Color.Red);

// Format the trend label.
TrendlineLabel tlabel = tline.Label;
tlabel.Font.Name = "Tahoma";
tlabel.Font.Italic = true;
tlabel.Fill.SetGradientFill(ShapeGradientType.Linear, Color.Orange, Color.White);
// Position the label in the right quarter of the chart area.
tlabel.Layout.Left.SetPosition(LayoutMode.Edge, 0.75);

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetPosition(LayoutMode, Double) method.

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.

See Also