You are here: Symbol Reference > MtxVecTee Namespace > Classes > TColorPalette Class > public > TColorPalette.CreateCustomRangePalette Method
MtxVec VCL
ContentsIndex
PreviousUpNext
TColorPalette.CreateCustomRangePalette Method

Create equidistant palette entries/levels.

Pascal
procedure CreateCustomRangePalette(ABottomColor: TColor; ATopColor: TColor; AMidColor: TColor; AMin: double; AMax: double; Steps: integer);

Create equidistant palette entries/levels by using AMin=ABottomColor, AMax=ATopColor and Steps parameters in method call. 

The mid color can be left out by specifying UsMidColor := False;

Create 20 equidistant palette entries starting with red color for values bellow -0 and ending with Blue color for values above 400. Keep in mind that when palCustom is used, the speed of bitmap fill-in equals (bitmap size in pixels) x (paletteSteps) and it is therefore meaningfull to use a smaller number of steps or use palAuto setting. When setting up custom range palettes they also depend on all parameters of the ColorPalette. This includes Rainbow settings. 

 

uses MtxExpr, Math387, MtxVec, MtxVecEdit; procedure TForm1.FormCreate(Sender: TObject); var A: Matrix; GridSeries: TMtxGridSeries; begin GridSeries := TMtxGridSeries.Create(Chart1); GridSeries.ColorPalette.PaletteScale := ppsNone; GridSeries.ColorPalette.PaletteStyle := palCustom; GridSeries.ColorPalette.Clear; GridSeries.ColorPalette.ColorBalance := 0; GridSeries.ColorPalette.UseMidColor := True; GridSeries.ColorPalette.CreateCustomRangePalette(clRed, clBlue,clWhite, 0, 400, 20); GridSeries.UpdateColor; A.Size(20,20); Vector(A).Ramp; DrawValues(A,GridSeries); end;

 

__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner) { sMatrix A; TMtxGridSeries *GridSeries; GridSeries = new TMtxGridSeries(Chart1); GridSeries->ColorPalette->PaletteScale = ppsNone; GridSeries->ColorPalette->PaletteStyle = palCustom; GridSeries->ColorPalette->Clear(); GridSeries->ColorPalette->ColorBalance = 0; GridSeries->ColorPalette->UseMidColor = true; GridSeries->ColorPalette->CreateCustomRangePalette(clRed, clBlue,clWhite, 0, 400, 20); GridSeries->UpdateColor(); A->Size(20,20); A()->Ramp(); //view A as a Vector ViewValues(A,"A",true); DrawValues(A,GridSeries); }
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!