Skip to main content
A newer version of this page is available. .
.NET Standard 2.0+

ChartObject.Style Property

Gets or sets the style to be applied to the chart.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

ChartStyle Style { get; set; }

Property Value

Type Description
ChartStyle

A ChartStyle enumeration value specifying the chart style.

Remarks

Use the Style property to apply one of the prebuilt styles defined by the ChartStyle enumeration members to the existing chart. Applying a style to the chart removes your custom formatting and sets the standard formatting determined by the selected style. Each style specifies the color of the data series, sets the chart’s background fill and applies different shape effects and outlines to the chart.

The visual appearance of the chart to which the predefined style is applied depends on the current theme specified in a workbook. Every document’s theme has a palette of colors which are used to set the colors of the chart. For example, you can select a colorful chart style which applies to each series one of the six accent colors, or you can specify a monochromatic design, which uses different shades of the same color for each series. The first series is painted a certain % shade of the specified accent color, and the last series is painted a certain % tint of that color. The intermediate colors are linearly interpolated by shade and tint of the selected color. You can change the accent colors by selecting another document’s theme or creating the custom one.

Example

The example below demonstrates how to create a chart and apply one of the predefined styles to it using the ChartObject.Style property.

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:D4"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Set the chart style.
chart.Style = ChartStyle.Accent1Dark

The following code snippets (auto-collected from DevExpress Examples) contain references to the Style 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.

See Also