Page 1 of 1
Palette with different colours
Posted: Wed Nov 02, 2005 5:48 pm
by 8438229
Hello,
I need to draw a TcolorGridSeries. I use the style psPale but I’d like to use other colours in a gradient way as it’s done in Pale Style. ¿How could I do it?
Thank you in advance,
Posted: Thu Nov 03, 2005 8:37 am
by narcis
Hi Elisabet,
Then you should set the Start, Middle and End colours you want for that gradient as done here:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var x,z: Integer;
begin
// Series1.PaletteStyle:=psPale;
Series1.StartColor:=clRed;
Series1.MidColor:=clBlue;
Series1.EndColor:=clGreen;
for x:=0 to 100 do
for z:=0 to 100 do
Series1.AddXYZ(x,x*z,z);
end;
Using that code snippet populates your series in a gradient way. Also using that for nested loop with psPale in the series also populates the series with colours like a gradient but the colours are the ones in the pale palette.
Posted: Thu Nov 03, 2005 9:14 am
by 8438229
Thank's for your fast answer. I've tried but i doesn't work. I have this code:
//PALETTE PROPERTIES
Series1->UsePalette=true;
Series1->UseColorRange=false;
//Series1->PaletteStyle=psPale;
Series1->PaletteMin=-1.00;
Series1->PaletteStep=0.1;
Series1->PaletteSteps=21;
//Change of colors
Series1->StartColor=clRed;
Series1->MidColor=clBlue;
Series1->EndColor=clGreen;
Chart1->Repaint();
I need to use the UsePalette becuase I need to set the properties of the legend: PaletteMIn, PaletteStep and PaletteSteps. ¿How could i change the colors?
Posted: Mon Nov 07, 2005 8:07 am
by Pep
Hi Elisabet,
It's more less simple. The following code will create three palette levels:
Code: Select all
// add random points
for (int i=1;i<10;i++)
for (int j=1;j<10;j++)
Series1->AddXYZ(i,random(10),j,"",clTeeColor);
// define three custom levels
Series1->UsePalette =true;
Series1->UseColorRange = false;
Series1->ClearPalette();
// up to 2.0 = yellow
Series1->AddPalette(2,clYellow);
// from 2.0 to 5.0 = green
Series1->AddPalette(5,clGreen);
// from 5.0 to 10 = red
Series1->AddPalette(10,clRed);