function Add(const AValue: double; AColor: TColor): Integer;
Add new custom palette level/entry.
Returns: Integer
Add new custom palette level/entry. Use this method to define custom (non-linear) palette entries. <Example>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): <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.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; </code> <code lang="C++"> #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); } </code> </Example> <SeeAlso cref="PaletteStyle"/> <SeeAlso cref="Clear"/>
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;