Skip to main content
All docs
V25.1
  • Create(TdxAlphaColor) Constructor

    Creates a palette item with the specified color.

    Declaration

    constructor Create(AColor: TdxAlphaColor); overload;

    Parameters

    Name Type Description
    AColor TdxAlphaColor

    Specifies primary and secondary colors of the created palette item.

    This parameter value initializes Color and Color2 fields.

    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 following code example creates a user palette with three colors and applies the palette to a Chart control:

    var
      AChartPalette: TdxChartUserPalette;
    begin
      AChartPalette := dxChartPaletteRepository1.CreateItem;
      AChartPalette.Name := 'My Palette 1'; // Assigns a unique palette name
      AChartPalette.Count := 3;  // Sets the size of the palette item array
      AChartPalette.Items[0] := TdxChartPaletteItem.Create(TdxAlphaColors.Red);
      AChartPalette.Items[1] := TdxChartPaletteItem.Create(TdxAlphaColors.Green);
      AChartPalette.Items[2] := TdxChartPaletteItem.Create(TdxAlphaColors.Blue);
      dxChartControl1.Palette := AChartPalette;
    end;
    

    VCL Chart Control: A Simple Custom Palette Example

    See Also