Automatic color of line series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Mike
Newbie
Newbie
Posts: 3
Joined: Thu Jun 14, 2007 12:00 am

Automatic color of line series

Post by Mike » Fri Jul 20, 2007 8:35 am

I have a chart with number of line series up to 25. These series are partitioned into different group.

The problem is that the lines have automaic different colors in the first ~20 series, but they become alway gray colors in the last few line series.

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

Post by Pep » Mon Jul 23, 2007 3:33 pm

Hi Mike,

yes, there's a predefined array of colors as default. In case you want to have more different colors you can always define a custom array of colors to use. It can be done as bellow :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
   t:integer;
begin
      SetLength(Chart1.ColorPalette,Length(RainbowPalette));
      for t:=0 to Length(RainbowPalette)-1 do
          Chart1.ColorPalette[t]:=RainbowPalette[t];
end; 

Mike
Newbie
Newbie
Posts: 3
Joined: Thu Jun 14, 2007 12:00 am

Post by Mike » Fri Jul 27, 2007 11:30 am

Thanks, Pep.

I get to know the colorpallete.
using Rainbow pallete, the colors of lines are quite close to each other. Thus, I still use default pallete, and set line.color:=GetDefaultColor(I mod Length(TeeProcs.ColorPalette)), so that color will repeat that in the colorpalette when the number of lines >length of colorpalette. I think there may be a bug with getdefaultcolor.

By the way, I did not receive the notification email.

Mike

Mike
Newbie
Newbie
Posts: 3
Joined: Thu Jun 14, 2007 12:00 am

Post by Mike » Fri Jul 27, 2007 11:37 am

I just find it is fine to just use
line.color:=GetDefaultColor(I) for ith line. The precedure of getdefaultcolor is fine.

Mike

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

Post by Pep » Fri Jul 27, 2007 4:14 pm

Hi Mike,

ok, yes you're correct, it's a bug (added on our bug list), once it arrives to 20 it should start again with the first color in the list.
I'm glad to hear you find the workaround.

Post Reply