New to Telerik UI for .NET MAUIStart a free 30-day trial

Defines a series color palette for RadChartBase. Each entry overrides the color for its slot index. Unset indices fall through to the theme token default (TelerikChartColor{1..6}).

Definition

Namespace:Telerik.Maui.Controls.Charts

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public sealed class ChartPalette : StyleableElement

Inheritance: objectChartPalette

Constructors

Initializes a new, empty instance of the ChartPalette class. Populate Entries after construction to define the palette's colors.

C#
public ChartPalette()

Initializes a new instance of the ChartPalette class and populates it with one ChartPaletteEntry per color in fillColors, in the same order, leaving each entry's StrokeColor unset.

C#
public ChartPalette(Color[] fillColors)
Parameters:fillColorsColor[]

An array of fill colors to populate the palette entries. If null, the resulting palette is empty.

Properties

Gets the observable collection of color entries that make up this palette. Add, remove, or replace entries at run time to update the palette; changes automatically trigger a chart redraw for any chart currently using this palette.

C#
public ObservableCollection<ChartPaletteEntry> Entries { get; }

Methods

Resolves the fill color to use for the series or slice occupying the given palette slot.

C#
public Color GetFillColor(int index, Color themeDefault)
Parameters:indexint

The zero-based palette slot index, typically the position of a series within Series.

themeDefaultColor

The color to return when index is out of range or the corresponding entry does not specify a FillColor.

Returns:

Color

The entry's FillColor if set and index is within range of Entries; otherwise, themeDefault.

Resolves the stroke color to use for the series or slice occupying the given palette slot.

C#
public Color GetStrokeColor(int index, Color themeDefault)
Parameters:indexint

The zero-based palette slot index, typically the position of a series within Series.

themeDefaultColor

The color to return when index is out of range or the corresponding entry does not specify a StrokeColor.

Returns:

Color

The entry's StrokeColor if set and index is within range of Entries; otherwise, themeDefault.