Page 1 of 1

Colorgird question

Posted: Wed Feb 16, 2005 4:02 pm
by 9336985
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;

Posted: Wed Feb 16, 2005 4:25 pm
by Marjan
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);

version

Posted: Wed Feb 16, 2005 4:46 pm
by 9336985
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

Posted: Thu Feb 17, 2005 8:17 am
by narcis
Hi Rick,

This week TeeChart Pro v7.04 VCL has been released and is available at our customer download area.

Still have problem

Posted: Thu Feb 17, 2005 3:10 pm
by 9336985
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

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

Posted: Fri Feb 18, 2005 4:10 pm
by 9336985
New thread started

Posted: Mon Feb 21, 2005 2:08 pm
by Pep
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;