Page 1 of 1

TPointSeries and colors of pointer

Posted: Mon Sep 10, 2012 7:40 am
by 16462341
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;

Re: TPointSeries and colors of pointer

Posted: Mon Sep 10, 2012 8:40 am
by yeray
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;