Is it possible for TAreaSeries to display in three color ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
nileiqi
Newbie
Newbie
Posts: 13
Joined: Fri Jan 12, 2007 12:00 am

Is it possible for TAreaSeries to display in three color ?

Post by nileiqi » Fri Feb 22, 2008 5:41 am

Hi,

I am try to use TAreaSeries in three different colour, the X axis is based on date & time, then there are three different time frames, in each time frame, I need TAreaSeries in different colors. Is it possible ? thanks.

Daniel

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri Feb 22, 2008 9:12 am

Hi Daniel,

You could set series' property "ColorEachPoint" to true and then assign the desired color to each point. Here is an example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i, FirstRange, SecondRange: Integer;
begin
  Series1.ColorEachPoint := true;

  Series1.FillSampleValues(30);
  Series1.XValues.DateTime := true;
  Chart1.Draw;

  FirstRange := 10;
  SecondRange := 20;

  for i:=0 to FirstRange-1 do
  begin
    Series1.ValueColor[i]:= RGB(176,0,0);
  end;

  for i:=FirstRange to SecondRange-1 do
  begin
    Series1.ValueColor[i]:= clRed;
  end;

  for i:=SecondRange to Series1.Count-1 do
  begin
    Series1.ValueColor[i]:= rgb(255,100,100);
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply