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

ChartView.VaryColors Property

Gets or sets a value indicating whether each data marker in the series should have a different color.

Namespace: DevExpress.Spreadsheet.Charts

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

bool VaryColors { get; set; }

#Property Value

Type Description
Boolean

true, if the same-series data markers are displayed in varied colors; otherwise, false.

#Remarks

By default, the slices in a pie or doughnut chart are varied, but you can turn this option off by setting the VaryColors property to false. As a result, the slices will be displayed as a single color instead of varied colors.

#Example

The example below demonstrates how to create a clustered column chart and automatically apply a different color to each data marker representing a data point on the chart. To vary colors of the same-series data markers point by point, set the ChartView.VaryColors property to true.

View Example

Worksheet worksheet = workbook.Worksheets["chartTask5"];
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["L15"];

// Specify that each data point in the series has a different color.
chart.Views[0].VaryColors = true;
// Hide the legend.
chart.Legend.Visible = false;

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