TPointSeries and colors of pointer

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Friis
Newbie
Newbie
Posts: 23
Joined: Mon May 07, 2012 12:00 am

TPointSeries and colors of pointer

Post by Friis » Mon Sep 10, 2012 7:40 am

When I use the code

Code: Select all

AddXY(xvalues,yvalues);
I can change the color of the point afterwards. BUT if i use the code

Code: Select all

AddXY(xvalue,yvalue,'',cllime);
I CANNOT change the color - see the code below. The code in Button1 is OK - the code in Button2 is Not ok....

I'm using CodeGear™ Delphi® 2007 for Win32® R2 Version 11.0.2902.10471 with Steema Teechart Pro v2012.05.120327 32BIT VCL

Code: Select all

procedure TForm10.Button1Click(Sender: TObject);
var
i : integer;
begin
Chart1.RemoveAllSeries;
Chart1.FreeAllSeries();
Chart1.Title.Text.Clear;
Chart1.Legend.Shadow.Visible := false;
Chart1.View3D := false;

Chart1.BottomAxis.DateTimeFormat := 'yyyy-mm-dd ' + #13 + 'hh:nn:ss';
Chart1.BottomAxis.Automatic := true;

Chart1.AddSeries(TPointSeries.Create(self));
Chart1[0].ParentChart := Chart1;
Chart1[0].XValues.DateTime := true;

for I := 0 to 9 do
  Chart1[0].AddXY(now+i/10,i);

if Chart1.SeriesCount >0 then
  with Chart1[0] as TpointSeries do
    begin
      Pointer.Color := clred;
      Pointer.Brush.Color :=  clred;
      Pointer.Brush.Style := bsSolid;
      seriescolor :=  clred;
    end;

end;

procedure TForm10.Button2Click(Sender: TObject);
var
i : integer;
begin
Chart1.RemoveAllSeries;
Chart1.FreeAllSeries();
Chart1.Title.Text.Clear;
Chart1.Legend.Shadow.Visible := false;
Chart1.View3D := false;

Chart1.BottomAxis.DateTimeFormat := 'yyyy-mm-dd ' + #13 + 'hh:nn:ss';
Chart1.BottomAxis.Automatic := true;

Chart1.AddSeries(TPointSeries.Create(self));
Chart1[0].ParentChart := Chart1;
Chart1[0].XValues.DateTime := true;

for I := 0 to 9 do
  Chart1[0].AddXY(now+i/10,i,'',cllime);

if Chart1.SeriesCount >0 then
  with Chart1[0] as TpointSeries do
    begin
      Pointer.Color := claqua;
      Pointer.Brush.Color :=  claqua;
      Pointer.Brush.Style := bsSolid;
      seriescolor :=  claqua;
    end;

end;

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

Re: TPointSeries and colors of pointer

Post by Yeray » Mon Sep 10, 2012 8:40 am

Hi Friis,

Right. The color set to the points prevails to the color set to the series. This is a per-design behaviour.
If you want to reset the color set to the points so the color set to the series can be used, you can set all the points color to clTeeColor prior:

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
var i : integer;
begin
  Chart1.RemoveAllSeries;
  Chart1.FreeAllSeries();
  Chart1.Title.Text.Clear;
  Chart1.Legend.Shadow.Visible := false;
  Chart1.View3D := false;

  Chart1.BottomAxis.DateTimeFormat := 'yyyy-mm-dd ' + #13 + 'hh:nn:ss';
  Chart1.BottomAxis.Automatic := true;

  Chart1.AddSeries(TPointSeries.Create(self));
  Chart1[0].ParentChart := Chart1;
  Chart1[0].XValues.DateTime := true;

  for I := 0 to 9 do
    Chart1[0].AddXY(now+i/10,i,'',cllime);

  if Chart1.SeriesCount >0 then
    with Chart1[0] as TpointSeries do
    begin
      for I := 0 to Count-1 do
        ValueColor[I]:=clTeeColor;

      Pointer.Color := claqua;
      Pointer.Brush.Color :=  claqua;
      Pointer.Brush.Style := bsSolid;
      seriescolor :=  claqua;
    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