Skip to main content

Palette Class

A palette (a collection of entries with two colors) that is used to draw a chart with the current appearance settings.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.dll

Declaration

[RuntimeObject]
public class Palette :
    CollectionBase,
    IPalette,
    ICloneable

Remarks

A palette is a collection of palette entries. Each palette entry is an instance of the PaletteEntry class and contains two colors (PaletteEntry.Color and PaletteEntry.Color2). These colors are used to draw chart elements with different appearance settings (gradient, hatch fill, and so on). To specify the appearance, use the ChartControl.AppearanceName property.

Use the ChartControl.PaletteName property to specify the chart palette. Available palettes are listed in the Palettes class as public static properties.

You can also create a custom palette. To do this, create a Palette object and use the PaletteRepository.RegisterPalette method to add the object to the ChartControl.PaletteRepository.

Example

The following example shows how to create a palette, register the palette, and apply it to a chart:

// Create a palette.
Palette palette = new Palette("Custom Palette");
palette.Add(Color.Yellow);
palette.Add(Color.Red);
palette.Add(Color.Green);
// Register the palette.
chartControl1.PaletteRepository.RegisterPalette(palette);
// Assign the palette to the chart.
chartControl1.PaletteName = "Custom Palette";
See Also