TColorPalette.CreateCustomRangePalette Method

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

Create equidistant palette entries/levels.

Result: stored in self (calling object)

Remarks:

Create equidistant palette entries/levels by using <i>AMin</i>=<i>ABottomColor</i>, <i>AMax</i>=<i>ATopColor</i> and <i>Steps</i> parameters in method call. The mid color can be left out by specifying UsMidColor := False; <Example>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. <code> 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; </code> <code lang="C++"> __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); } </code> </Example> <SeeAlso cref="PaletteStyle"/>

Examples
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;