Point3D with different color?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Point3D with different color?

Post by moelski » Sat May 31, 2008 11:12 am

Hi !

I have just started drawing GPS information to TChart. And it works very well (and easy) if I use TPoint3D.

But it would be great to have the lines between the 3D points in different colors. So it would be possible to view speed information within the GPS 3D data.
So it should look like this (the red / blue line):
Image

This example only uses two colors but I think you could imagine what I´m thinking about.

I tried something like this:

Code: Select all

  Series1.pen.color := RGB(255, 255, 0);
  Series1.AddXYZ(1, 2, 3);
  Series1.pen.color := RGB(255, 0, 0);
  Series1.AddXYZ(3, 20, 4);
  Series1.pen.color := RGB(0, 0, 255);
  Series1.AddXYZ(3, 20, 40);
But in this case only the last color is used by TChart - for the whole graph.

Is it generally possible to have different colors for the lines between the 3D points?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jun 02, 2008 1:45 pm

Hi Dominik,

Yes, you can hide series' lines and customly draw your own as shown here:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  With Series1 do
  begin
    AddXYZ(random,random,random, '', clRed);
    AddXYZ(random,random,random, '', clBlue);
    AddXYZ(random,random,random, '', clGreen);
    AddXYZ(random,random,random, '', clYellow);
    AddXYZ(random,random,random, '', clWhite);
    LinePen.Visible:=false;
  end;
end;

procedure TForm1.Series1BeforeDrawValues(Sender: TObject);
var i: integer;
begin
  With Chart1.Canvas, Series1 do
  begin
    for i:=0 to Count-2 do
    begin
      Chart1.Canvas.Pen.Color:=ValueColor[i];
      MoveTo3D(CalcXPos(i),CalcYPos(i),CalcZPos(i));
      LineTo3D(CalcXPos(i+1),CalcYPos(i+1),CalcZPos(i+1));
    end;
  end;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Mon Jun 02, 2008 1:47 pm

Hi Narcis,

oh that´s the trick :D

I will give it a try. Thx for the moment. 8)

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Wed Jun 04, 2008 4:48 am

Works perfect Narcis.

Thx !

Post Reply