Back to Devexpress

TdxChartPaletteItem Record

vcl-dxchartpalette-460bdbd6.md

latest4.0 KB
Original Source

TdxChartPaletteItem Record

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

Declaration

delphi
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.

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.

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.

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.

delphi
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;
cpp
// ...
  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

Direct TdxChartPaletteItem Record References

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

TdxChartPaletteItem Members

dxChartPalette Unit