TdxChartPalette.GetColorsForIndex(Integer) Method
Returns a stored or interpolated palette item for the target index.
Declaration
function GetColorsForIndex(AIndex: Integer): TdxChartPaletteItem;
Parameters
Name | Type | Description |
---|---|---|
AIndex | Integer | The target palette item index (
Note As the specified index increases, the difference between two adjacent interpolated colors becomes less distinguishable. |
Returns
Type | Description |
---|---|
TdxChartPaletteItem | A stored or interpolated palette item. |
Remarks
While a Chart palette (a TdxChartPalette class descendant instance) stores a finite number of items, you can call the GetColorsForIndex
function to generate any number of palette items whose Color and Color2 field values are interpolated based on stored palette item colors.
Code Example
The following code example demonstrates a diagram’s OnGetSeriesPointDrawParameters event handler that uses the Slipstream predefined palette to generate unique fill colors for all point markers in the Europe series:
procedure TFeaturesDemoMainForm.cdLineGetSeriesPointDrawParameters(
Sender: TdxChartCustomDiagram;
AArgs: TdxChartGetSeriesPointDrawParametersEventArgs);
var
ALineDrawParameters: TdxChartLineSeriesPointDrawParameters;
APalette: TdxChartPalette;
APaletteItem: TdxChartPaletteItem;
begin
APalette := TdxChartStandardPaletteRepository.FindPalette('Slipstream');
if AArgs.SeriesPoint.Series.Caption = 'Europe' then
begin
if AArgs.DrawParameters.ClassType <> TdxChartLineSeriesPointDrawParameters then Exit;
ALineDrawParameters := AArgs.DrawParameters as TdxChartLineSeriesPointDrawParameters;
APaletteItem := APalette.GetColorsForIndex(AArgs.SeriesPoint.Index);
ALineDrawParameters.MarkerAppearance.FillOptions.Color := APaletteItem.Color;
end;
end;