Setting individual points in TPointSeries to different color

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

Post by Brino » Fri Apr 16, 2004 3:41 pm

maybe this will work...

ASeries := TPointSeries.Create;
ASeries.ParentChart := Chart1;
ASeries.FillSampleValues(10);

for i := 0 to ASeries.Count -1 do
begin
if ASeries.XValues < 5 then
ASeries.ValueColor := clGreen;

if ASeries.XValues > 5 then
ASeries.ValueColor := clWhite;
end;

etc...

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

Post by Marjan » Mon Apr 19, 2004 12:30 pm

Hi.

For some pointer styles TeeChart Pen color is not matched to current point color. A workaround is to manually "hard-code" Pen color right before the symbol is drawn. For this you can use series OnGetPointerStyle event. The following code works fine:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(3);
  Series1.ColorEachPoint := True;
end;

function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  Sender.ParentChart.Canvas.Pen.Color := Sender.ValueColor[ValueIndex];
  Result := psStar;
end;
Marjan Slatinek,
http://www.steema.com

Post Reply