I have a TPoint3DSeries and I would like to draw lines between various pairs of points (not just connect them in sequence). What is the best (simplest) way? For 2D I used TArrowSeries and that worked well. Is there a 3D equivalent?
Thanks, Jim
Lines between 3D points?
Re: Lines between 3D points?
Hello,
You could use a second TPoint3DSeries with hidden Pointers and copy points from a series to the other.
In this example, I'm calling this second series "Links":
You could use a second TPoint3DSeries with hidden Pointers and copy points from a series to the other.
In this example, I'm calling this second series "Links":
Code: Select all
uses TeePoin3;
var Series1, Links: TPoint3DSeries;
procedure TForm1.FormCreate(Sender: TObject);
procedure AddLink(ValueIndex1, ValueIndex2: Integer);
begin
Links.AddXYZ(Series1.XValue[ValueIndex1], Series1.YValue[ValueIndex1], Series1.ZValue[ValueIndex1]);
Links.AddXYZ(Series1.XValue[ValueIndex2], Series1.YValue[ValueIndex2], Series1.ZValue[ValueIndex2]);
Links.AddNull(0);
end;
begin
Series1:=Chart1.AddSeries(TPoint3DSeries) as TPoint3DSeries;
Series1.FillSampleValues;
Series1.LinePen.Visible:=False;
Links:=Chart1.AddSeries(TPoint3DSeries) as TPoint3DSeries;
Links.Pointer.Visible:=False;
AddLink(2,6);
AddLink(2,10);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Lines between 3D points?
So I would then have a new series for each line segment I need to draw? It would work but a generalization of TArrowSeries to 3D would be much more elegant and would make 3D just a generalization of 2D.
Re: Lines between 3D points?
Hello Jim,
If you look at the sample code I posted, you'll see I'm adding 3 points for each segment into the same series. Two of these points are the origin and destination points for the line to be drawn, and the third point is a null point, so the next time we add a line segment, we aren't connecting them.
If you look at the sample code I posted, you'll see I'm adding 3 points for each segment into the same series. Two of these points are the origin and destination points for the line to be drawn, and the third point is a null point, so the next time we add a line segment, we aren't connecting them.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Lines between 3D points?
Oh, I did not notice that. Not elegant but should work. Thanks.
Re: Lines between 3D points?
I tried that and it works except for one odd problem. If there is a line segment connecting the last point to some other point then when I rotate the chart with the mouse in some views a line suddenly appears connecting the last point to the first point. If no line connects the last point then this does not seem to happen. I know that you would like a small demo of the problem but this is all withing the large program I am working on that generates the data to be plotted.
Re: Lines between 3D points?
Oh, I just discovered that the 3D vector series I needed actually does exist. The TVector3DSeries series is in the VCLTee.TeeSurfa unit. Now the problem is that some lines display too light (see the screenshot). Perhaps they are drawn but much too light.
Re: Lines between 3D points?
Hello,
http://bugs.teechart.net/show_bug.cgi?id=1822
I see the problem is the lines in the Point3DSeries doesn't respect the null points. I've added it to the public tracker:JimR wrote:I tried that and it works except for one odd problem. If there is a line segment connecting the last point to some other point then when I rotate the chart with the mouse in some views a line suddenly appears connecting the last point to the first point. If no line connects the last point then this does not seem to happen. I know that you would like a small demo of the problem but this is all withing the large program I am working on that generates the data to be plotted.
http://bugs.teechart.net/show_bug.cgi?id=1822
Right, sorry. You can use the TVector3DSeries as follows:JimR wrote:Oh, I just discovered that the 3D vector series I needed actually does exist. The TVector3DSeries series is in the VCLTee.TeeSurfa unit.
Code: Select all
uses TeePoin3, TeeSurfa;
var Series1: TPoint3DSeries;
Vector: TVector3DSeries;
procedure TForm1.FormCreate(Sender: TObject);
procedure AddVector(ValueIndex1, ValueIndex2: Integer);
begin
Vector.AddVector(Series1.XValue[ValueIndex1], Series1.YValue[ValueIndex1], Series1.ZValue[ValueIndex1],
Series1.XValue[ValueIndex2], Series1.YValue[ValueIndex2], Series1.ZValue[ValueIndex2]);
end;
begin
Series1:=Chart1.AddSeries(TPoint3DSeries) as TPoint3DSeries;
Series1.FillSampleValues(5);
Series1.LinePen.Visible:=False;
Series1.Marks.Visible:=True;
Series1.Marks.Style:=smsPointIndex;
Vector:=Chart1.AddSeries(TVector3DSeries) as TVector3DSeries;
Vector.UseColorRange:=False;
Vector.Color:=clBlack;
AddVector(2,4);
AddVector(1,3);
AddVector(3, Series1.Count-1);
end;
You only have to disable UseColorRange as shown aboveJimR wrote:Now the problem is that some lines display too light (see the screenshot). Perhaps they are drawn but much too light.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Lines between 3D points?
OK, this solves that problem - thanks.