Skip to main content
All docs
V24.1

TdxChartPaletteRepository.CreateItem(string) Method

Creates a new user palette with the specified name.

Declaration

function CreateItem(const AName: string): TdxChartUserPalette; overload;

Parameters

Name Type Description
AName string

The unique name of the created user palette.

The AName parameter value initializes the palette’s Name property.

Returns

Type Description
TdxChartUserPalette

The created user palette.

Remarks

Call the CreateItem function to create an empty user palette with the specified name.

Code Example: Create and Populate a User Palette

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;

VCL Chart Control: A Custom Palette with Two Color Pairs for Gradients

See Also