The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

ShapeOutlineFill.GradientFill Property

Provides access to the settings of the gradient fill applied to a drawing object's element.

Namespace: DevExpress.Spreadsheet.Drawings

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

Declaration

ShapeGradientFill GradientFill { get; }
ReadOnly Property GradientFill As ShapeGradientFill
ShapeGradientFill GradientFill { get; }
ReadOnly Property GradientFill As ShapeGradientFill
ShapeGradientFill GradientFill { get; }
ReadOnly Property GradientFill As ShapeGradientFill

Property Value

Type Description
ShapeGradientFill

A ShapeGradientFill object containing gradient fill options.

Property Value

Type Description
ShapeGradientFill

A ShapeGradientFill object containing gradient fill options.

Property Value

Type Description
ShapeGradientFill

A ShapeGradientFill object containing gradient fill options.

Remarks

To apply a gradient fill to a drawing object's element, call the ShapeOutlineFill.SetGradientFill method. Use the GradientFill property to adjust the gradient settings (to add additional gradient stops by utilizing the ShapeGradientFill.Stops property, set the angle of the gradient fill by using the ShapeGradientFill.Angle property, specify a region of the chart element to which the gradient is applied via the ShapeGradientFill.TileRect property, or define the gradient direction by utilizing the ShapeComplexFill.FillRect property).

Examples

The example below demonstrates how to create a clustered column chart and adjust its appearance. First, add the chart title and change the font color via the ShapeTextFont.Color property. Make the plot area transparent by using the ShapeOutlineFill.SetNoFill method, and then apply the gradient fill to the chart area by utilizing the ShapeOutlineFill.SetGradientFill method. To set the picture fill for all columns in a chart, call the ShapeFill.SetPictureFill method for a series object. Finally, change the color of the primary axes by utilizing the ShapeOutlineFill.SetSolidFill method and specify the axis width via the ShapeOutline.Width property.

Note

A complete sample project is available in the DevExpress-Examples/spreadsheet-chart-api-examples-t132724 repository on GitHub.

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

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

// Add and format the chart title.
chart.Title.SetValue("Countries with the largest forest area");
chart.Title.Font.Color = Color.FromArgb(0x34, 0x5E, 0x25);

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

// Apply the gradient fill to the chart area.
chart.Fill.SetGradientFill(ShapeGradientType.Linear, Color.FromArgb(0xFD, 0xEA, 0xDA), Color.FromArgb(0x77, 0x93, 0x3C));
ShapeGradientFill gradientFill = chart.Fill.GradientFill;
gradientFill.Stops.Add(0.78f, Color.FromArgb(0xB7, 0xDE, 0xE8));
gradientFill.Angle = 90;

// Set the picture fill for the data series.
chart.Series[0].Fill.SetPictureFill("Pictures\\PictureFill.png");

// Customize the axis appearance.
AxisCollection axisCollection = chart.PrimaryAxes;
foreach (Axis axis in axisCollection)
{
    axis.MajorTickMarks = AxisTickMarks.None;
    axis.Outline.SetSolidFill(Color.FromArgb(0x34, 0x5E, 0x25));
    axis.Outline.Width = 1.25;
}
// Change the scale of the value axis.
Axis valueAxis = axisCollection[1];
valueAxis.Scaling.AutoMax = false;
valueAxis.Scaling.Max = 8000000;
valueAxis.Scaling.AutoMin = false;
valueAxis.Scaling.Min = 0;
// Specify display units for the value axis.
valueAxis.DisplayUnits.UnitType = DisplayUnitType.Thousands;
valueAxis.DisplayUnits.ShowLabel = true;

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