Only first point of a series in different color

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Andreas iCD
Newbie
Newbie
Posts: 12
Joined: Mon Jan 17, 2011 12:00 am

Only first point of a series in different color

Post by Andreas iCD » Fri Apr 29, 2011 10:07 am

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

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

Re: Only first point of a series in different color

Post by Yeray » Fri Apr 29, 2011 3:11 pm

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 19606 times
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

Andreas iCD
Newbie
Newbie
Posts: 12
Joined: Mon Jan 17, 2011 12:00 am

Re: Only first point of a series in different color

Post by Andreas iCD » Tue May 03, 2011 7:22 am

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

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

Re: Only first point of a series in different color

Post by Yeray » Wed May 04, 2011 12:05 pm

Hello Andreas,

I'm glad to hear that!
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