Palette with different colours

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Elisabet
Newbie
Newbie
Posts: 22
Joined: Fri Nov 15, 2002 12:00 am
Location: Madrid

Palette with different colours

Post by Elisabet » Wed Nov 02, 2005 5:48 pm

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,

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 03, 2005 8:37 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Elisabet
Newbie
Newbie
Posts: 22
Joined: Fri Nov 15, 2002 12:00 am
Location: Madrid

Post by Elisabet » Thu Nov 03, 2005 9:14 am

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?

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 07, 2005 8:07 am

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

Post Reply