Skip to main content
All docs
V24.2

Create(TdxAlphaColor,TdxAlphaColor) Constructor

Creates a palette item with specified primary and secondary colors.

Declaration

constructor Create(AColor: TdxAlphaColor; AColor2: TdxAlphaColor); overload;

Parameters

Name Type Description
AColor TdxAlphaColor

Specifies the primary color of the created palette item.

This parameter value initializes the Color field.

AColor2 TdxAlphaColor

Specifies the secondary color of the created palette item. Secondary palette colors are used only in gradient or hatch fill modes.

This parameter value initializes the Color2 field.

Remarks

Call this constructor to create a new palette item for a user palette. Assign the created item to the palette’s Items property as demonstrated in the code example below.

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