Colorgird question

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
RSpence
Newbie
Newbie
Posts: 33
Joined: Fri Apr 02, 2004 5:00 am
Location: UK / Florida
Contact:

Colorgird question

Post by RSpence » Wed Feb 16, 2005 4:02 pm

Hi There,

New to T-Chart, and having trouble getting a ColorGrid to work with my own palette. Sure it's something stupid I'm doing but I've been banging my head against a wall for a few hours....

So, I have a TChart component and a TColorGrid series on a form. If I use the design time editor, with one of the standard paletee styles (pale) everything is pretty much working ok. Trying to change the color palette, though, using the code below, is resulting in a legend showing with just one value: 1000, with a color of red. There's obviously some property I need to set...

series1.Clear;
series1.ClearPalette();
series1.UseColorRange:=false;
series1.UsePalette:=true;

series1.PaletteSteps:=10;
series1.UsePaletteMin := false;
series1.PaletteStep := 100;
series1.PaletteMin := 0;

// For testing - in practice these will all be diff.
series1.AddPalette(100,ClAqua);
series1.AddPalette(200,ClAqua);
series1.AddPalette(300,ClAqua);
series1.AddPalette(400,ClAqua);
series1.AddPalette(500,ClAqua);
series1.AddPalette(600,Clred);
series1.AddPalette(700,Clred);
series1.AddPalette(800,Clred);
series1.AddPalette(900,Clred);
series1.AddPalette(1000, clRed);



y := 0;
for z := 0 to 60 do
for x := 0 to 85 do
begin
series1.AddXYZ(x, y, z);
y := (y + 1) mod 1001 ;
end;

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Feb 16, 2005 4:25 pm

Hi.

Which TeeChart version are you using ? Using the latest version and the code below the result is chart with 10 palette entries and two different colors(aqua for values up to 500 and red for values above 500):

Code: Select all

  series1.Clear;
  series1.ClearPalette();
  series1.UseColorRange:=false;
  series1.UsePalette:=true;
  // For testing - in practice these will all be diff.
  series1.AddPalette(100,ClAqua);
  series1.AddPalette(200,ClAqua);
  series1.AddPalette(300,ClAqua);
  series1.AddPalette(400,ClAqua);
  series1.AddPalette(500,ClAqua);
  series1.AddPalette(600,Clred);
  series1.AddPalette(700,Clred);
  series1.AddPalette(800,Clred);
  series1.AddPalette(900,Clred);
  series1.AddPalette(1000, clRed);
Marjan Slatinek,
http://www.steema.com

RSpence
Newbie
Newbie
Posts: 33
Joined: Fri Apr 02, 2004 5:00 am
Location: UK / Florida
Contact:

version

Post by RSpence » Wed Feb 16, 2005 4:46 pm

Hi Marjan,

Pro V7 for Delphi 7. BPL files dated 3/5/2004 11:07 AM. Guess I'll see if there's an update..

Regards,

RIck

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 Feb 17, 2005 8:17 am

Hi Rick,

This week TeeChart Pro v7.04 VCL has been released and is available at our customer download area.
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

RSpence
Newbie
Newbie
Posts: 33
Joined: Fri Apr 02, 2004 5:00 am
Location: UK / Florida
Contact:

Still have problem

Post by RSpence » Thu Feb 17, 2005 3:10 pm

Hi,

Thanks for support so far. I downloaded the 7.04 version, and I still have the same problem - but I have news.

1. If I use the code I showed previously on a new chart, it works as expected with a minor glitch - I get two entries in the palette for each value between 300 & 900 - just one value for 200 & 1000.

2. If I use the code on a chart which I had previously configured using the editor, and now want to change, it fails in the way I indicated. Obviously, I need to reset . undo something that I configured in the editor. Scratched my head for a while but can't see it?

Thanks in advance,

Rick

RSpence
Newbie
Newbie
Posts: 33
Joined: Fri Apr 02, 2004 5:00 am
Location: UK / Florida
Contact:

Start new trread as I didn't get a reply...

Post by RSpence » Fri Feb 18, 2005 4:10 pm

New thread started

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

Post by Pep » Mon Feb 21, 2005 2:08 pm

Hi Rick,

how about doing :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var y,x,z : integer;
begin
Series1.FillSampleValues(5);

series1.Clear;
series1.ClearPalette(); 
series1.UseColorRange:=false;
series1.UsePalette:=true;

// For testing - in practice these will all be diff. 
series1.AddPalette(100,ClAqua);
series1.AddPalette(200,ClAqua); 
series1.AddPalette(300,ClAqua); 
series1.AddPalette(400,ClAqua); 
series1.AddPalette(500,ClAqua);
series1.AddPalette(600,Clred); 
series1.AddPalette(700,Clred); 
series1.AddPalette(800,Clred); 
series1.AddPalette(900,Clred);
series1.AddPalette(1000, clRed); 

series1.PaletteSteps:=10;
series1.UsePaletteMin := false;
series1.PaletteStep := 100;
series1.PaletteMin := 0;


y := 0;
for z := 0 to 60 do
for x := 0 to 85 do
begin
series1.AddXYZ(x, y, z);
y := (y + 1) mod 1001 ;
end; 

Post Reply