Page 1 of 1

Only first point of a series in different color

Posted: Fri Apr 29, 2011 10:07 am
by 16458388
Hello,
I have transferred a Delphi software project using TeeChart Pro from TeeChart version 7 (and BDS 2006) to TeeChart version 2010 (and RAD-Studio 2010). Now everything worked fine except of one (little?) problem:

The following code fragment should color each point of a LineSeries in a different color, depending on the value of SpecViolationLevel (0..3):

Code: Select all

  TLineSeries(Series).ColorEachLine:=False;
  Series.SeriesColor:=clBlue;
  for j:=0 to Count-1 do
  begin
   if Data[j].Value.Valid then
   begin
     case Data[j].SpecViolationLevel of
      0: Series.AddXY(Data[j].GetCurrentXValue(j),Data[j].Value.Value,GetXLabel(j),clblue);
      1: Series.AddXY(Data[j].GetCurrentXValue(j),Data[j].Value.Value,GetXLabel(j),clYellow);
      2: Series.AddXY(Data[j].GetCurrentXValue(j),Data[j].Value.Value,GetXLabel(j),clRed);
      3: Series.AddXY(Data[j].GetCurrentXValue(j),Data[j].Value.Value,GetXLabel(j),clPurple);
     end;
   end;
  end; 
Now the problem is, that when starting the application with the new TeeChart 2010 only the first point of the series is colored in the expected color (e.g. yellow, if its SpecViolationLevel=1), the other points remain in the basic color of the series (blue in the example above). In former times (i.e. with TeeChart 7 and even earlier versions) this code worked.
I did not set the property Series.ColorEachPoint in my code. However - as I explained - it worked in this way before I changed to the new TeeChart version.
Using Series.ColorEachPoint:=true did not have any effect in my case.
Do you have any idea or help?

Thanks,
Andreas

Re: Only first point of a series in different color

Posted: Fri Apr 29, 2011 3:11 pm
by yeray
Hello Andreas,

Could you please check if you are using the latest version available in the client area?
I've simplified your example a little bit to make it run here:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TLineSeries;
    j: Integer;
begin
  Chart1.View3D:=false;

  Series1:=Chart1.AddSeries(TLineSeries) as TLineSeries;
  Series1.Pointer.Visible:=true;
  Series1.ColorEachLine:=false;
  Series1.SeriesColor:=clBlue;

  for j:=0 to 10 do
  begin
    case (j mod 4) of
     0: Chart1[0].AddXY(j,random*100,'',clblue);
     1: Chart1[0].AddXY(j,random*100,'',clYellow);
     2: Chart1[0].AddXY(j,random*100,'',clRed);
     3: Chart1[0].AddXY(j,random*100,'',clPurple);
    end;
  end;
end;
The code above give this result for me here with the latest version (v2011.03):
Chart1.png
Chart1.png (12.03 KiB) Viewed 5272 times

Re: Only first point of a series in different color

Posted: Tue May 03, 2011 7:22 am
by 16458388
Hi Yeray,
thanks for your quick help: I did not use the latest version of TeeChart when posting my problem but now I'm doing so, and actually, everything works fine! :D

Best regards,
Andreas

Re: Only first point of a series in different color

Posted: Wed May 04, 2011 12:05 pm
by yeray
Hello Andreas,

I'm glad to hear that!