Skip to main content
All docs
V25.1
  • TdxChartPaletteItem Record

    A chart palette item that stores a set of primary and secondary fill colors.

    Declaration

    TdxChartPaletteItem = record

    Remarks

    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.

    VCL Chart Control: Chart Palette Item Examples

    Main API Members

    The list below outlines key members of the TdxChartPaletteItem record. These members allow you to work with palette colors and color sets.

    Color
    Stores the primary palette color.
    Color2
    Stores the secondary palette color used in gradient and hatch fill modes.
    Create
    These two overloaded constructors allow you to create a palette item and explicitly initialize color-related fields.

    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

    Direct TdxChartPaletteItem Record References

    The following public API members reference the TdxChartPaletteItem record:

    TdxChartPalette.GetColorsForIndex
    Returns a stored or interpolated palette item for the target index.
    TdxChartPalette.Items
    Provides indexed access to all explicitly defined (stored) Chart palette items.
    TdxChartUserPalette.Items
    Provides indexed access to stored user palette items.
    TdxChartPaletteItems
    An array of chart palette items.
    See Also