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,
Palette with different colours
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Elisabet,
Then you should set the Start, Middle and End colours you want for that gradient as done here:
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.
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;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
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?
//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?
Hi Elisabet,
It's more less simple. The following code will create three palette levels:
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);
Pep Jorge
http://support.steema.com
http://support.steema.com