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

Add new custom palette level/entry.

Pascal
function Add(const AValue: double; AColor: TColor): Integer;

Add new custom palette level/entry. Use this method to define custom (non-linear) palette entries.

Define three custom levels. For this we need three custom palette entries. First level will be defined by red color and interval (-infinity,79], second level will be defined by white color and interval (79, 179], and third level will be defined by blue color and interval (179,infinity): 

 

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.Add(79,clRed); GridSeries.ColorPalette.Add(179,clWhite); GridSeries.ColorPalette.Add(400,clBlue); GridSeries.UpdateColor; A.Size(20,20); Vector(A).Ramp; DrawValues(A,GridSeries); end;

 

#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" __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->Add(79,clRed); GridSeries->ColorPalette->Add(179,clWhite); GridSeries->ColorPalette->Add(400,clBlue); GridSeries->UpdateColor(); A.Size(20,20); A()->Ramp(); //view A as a Vector and call Vector method 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!