Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ShapeRectangleOffset Interface

Defines the offsets from the corresponding edges of the shape to which the gradient or picture fill is applied.

Namespace: DevExpress.Spreadsheet.Drawings

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

public interface ShapeRectangleOffset

The following members return ShapeRectangleOffset objects:

#Remarks

An object exposing the ShapeRectangleOffset interface is used to specify the ShapeComplexFill.FillRect, ShapePictureFill.SourceRect and ShapeGradientFill.TileRect properties.

#Example

The following example demonstrates how to create a scatter chart with straight lines and markers and customize its appearance by applying the complex gradient to the chart background. Set the gradient fill by calling the ShapeOutlineFill.SetGradientFill method, and then specify the gradient direction From Center by utilizing the ShapeComplexFill.FillRect property.

View Example

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

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ScatterLineMarkers, worksheet["C2:D52"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L17"];

// Set the series line color.
chart.Series[0].Outline.SetSolidFill(Color.FromArgb(0xBC, 0xCF, 0x02));

// Specify the data markers.
Marker markerOptions = chart.Series[0].Marker;
markerOptions.Symbol = MarkerStyle.Diamond;
markerOptions.Size = 10;
markerOptions.Fill.SetSolidFill(Color.FromArgb(0xBC, 0xCF, 0x02));
markerOptions.Outline.SetNoFill();

// Set no fill for the plot area.
chart.PlotArea.Fill.SetNoFill();

// Apply the gradient fill to the chart area.
chart.Fill.SetGradientFill(ShapeGradientType.Circle, Color.FromArgb(0xE3, 0x48, 0x03), Color.FromArgb(0x00, 0x32, 0x86));
ShapeGradientFill gradientFill = chart.Fill.GradientFill;
gradientFill.FillRect.Left = 0.5;
gradientFill.FillRect.Right = 0.5;
gradientFill.FillRect.Bottom = 0.5;
gradientFill.FillRect.Top = 0.5;

// Set the X-axis scale.
Axis axisX = chart.PrimaryAxes[0];
axisX.Scaling.AutoMax = false;
axisX.Scaling.AutoMin = false;
axisX.Scaling.Max = 60.0;
axisX.Scaling.Min = -60.0;
axisX.MajorGridlines.Visible = true;
axisX.Visible = false;

// Set the Y-axis scale.
Axis axisY = chart.PrimaryAxes[1];
axisY.Scaling.AutoMax = false;
axisY.Scaling.AutoMin = false;
axisY.Scaling.Max = 50.0;
axisY.Scaling.Min = -50.0;
axisY.MajorUnit = 10.0;
axisY.Visible = false;

// Hide the chart legend.
chart.Legend.Visible = false;
See Also