vcl-dxchartpalette-460bdbd6.md
A chart palette item that stores a set of primary and secondary fill colors.
TdxChartPaletteItem = record
Predefined and user palettes store sets of primary and secondary colors as palette items. Secondary colors are used only in gradient and hatch fill modes.
The list below outlines key members of the TdxChartPaletteItem record. These members allow you to work with palette colors and color sets.
ColorStores the primary palette color.Color2Stores the secondary palette color used in gradient and hatch fill modes.CreateThese two overloaded constructors allow you to create a palette item and explicitly initialize color-related fields.
The code example below creates a user palette, populates it with three sets of different primary and secondary colors, and applies the created palette to a Chart control with three simple Bar series. All series bars are filled with vertical linear gradients.
var
AChartPalette: TdxChartUserPalette;
begin
AChartPalette := dxChartPaletteRepository1.CreateItem('My Palette 1');
AChartPalette.Count := 3; // Sets the size of the palette item array
AChartPalette.Items[0] := TdxChartPaletteItem.Create(TdxAlphaColors.RosyBrown, TdxAlphaColors.Red);
AChartPalette.Items[1] := TdxChartPaletteItem.Create(TdxAlphaColors.LightGreen, TdxAlphaColors.Green);
AChartPalette.Items[2] := TdxChartPaletteItem.Create(TdxAlphaColors.LightBlue, TdxAlphaColors.Blue);
dxChartControl1.Palette := AChartPalette; // Applies the created palette to a Chart control
end;
// ...
TdxChartUserPalette *AChartPalette;
// ...
AChartPalette = dxChartPaletteRepository1->CreateItem("My Palette 1");
AChartPalette->Count = 3; // Sets the size of the palette item array
AChartPalette->Items[0] = TdxChartPaletteItem(TdxAlphaColors::RosyBrown, TdxAlphaColors::Red);
AChartPalette->Items[1] = TdxChartPaletteItem(TdxAlphaColors::LightGreen, TdxAlphaColors::Green);
AChartPalette->Items[2] = TdxChartPaletteItem(TdxAlphaColors::LightBlue, TdxAlphaColors::Blue);
dxChartControl1->Palette = AChartPalette; // Applies the created palette to a Chart control
The following public API members reference the TdxChartPaletteItem record:
TdxChartPalette.GetColorsForIndexReturns a stored or interpolated palette item for the target index.TdxChartPalette.ItemsProvides indexed access to all explicitly defined (stored) Chart palette items.TdxChartUserPalette.ItemsProvides indexed access to stored user palette items.TdxChartPaletteItemsAn array of chart palette items. See Also