How can I draw nice 3D Arrows to depict axes (a,b,c)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
axrDegen
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am

How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by axrDegen » Mon Feb 11, 2019 8:05 pm

Hello,

How can I draw nice 3D arrows like in the attached picture?
By using the code below I only get "flat" arrows
and can't draw an arrow in Z direction:

Code: Select all

var
  tmpX,tmpY,tmpZ: Integer;
  FromPoint,ToPoint: TPoint;
begin
  tmpY := Chart.ChartYCenter + Round(Chart.Canvas.RotationCenter.Y);
  tmpX := Chart.ChartXCenter + Round(Chart.Canvas.RotationCenter.X);
  tmpZ := (Chart.Width3D div 2) + Round(Chart.Canvas.RotationCenter.Z);
  StrainChart.Canvas.Pen.Color := clRed;
  StrainChart.Canvas.Pen.Width := 4;
  StrainChart.Canvas.Pen.Style := psSolid;

  FromPoint.X := Chart.ChartRect.Left;
  FromPoint.Y := tmpY;
  ToPoint.X := Chart.ChartRect.Right;
  ToPoint.Y := tmpY;
  Chart.Canvas.Arrow(True, FromPoint, ToPoint, 50, 50, tmpZ);

  FromPoint.X := tmpX;
  FromPoint.Y := Chart.ChartRect.Bottom;
  ToPoint.X := tmpX;
  ToPoint.Y := StrainChart.ChartRect.Top;
  Chart.Canvas.Arrow(True, FromPoint, ToPoint, 50, 50, tmpZ);
Nice3DArrowsCapture.PNG
Nice3DArrowsCapture.PNG (62.85 KiB) Viewed 82 times
Flat2DArrowsCapture.PNG
Flat2DArrowsCapture.PNG (108.13 KiB) Viewed 82 times

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

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by Yeray » Mon Feb 18, 2019 9:11 am

Hello,

You can give it a try at the Vector series. Ie:

Code: Select all

uses TeeSurfa;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with Chart1 do
  begin
    Chart3DPercent:=100;
    Aspect.Orthogonal:=False;
    Aspect.Zoom:=70;
    Legend.Hide;

    Axes.Left.SetMinMax(0,10);
    Axes.Bottom.SetMinMax(0,10);
    Axes.Depth.SetMinMax(0,10);
    Axes.Depth.Visible:=True;

    Axes.Left.Increment:=1;
    Axes.Bottom.Increment:=1;
    Axes.Depth.Increment:=1;
  end;

  with Chart1.AddSeries(TVector3DSeries) as TVector3DSeries do
  begin
    Color:=clRed;
    Pen.Width:=2;
    ArrowHeight:=10;
    ArrowWidth:=10;
    AddVector(5,5,5,0,5,5,'', clRed);
    AddVector(5,5,5,10,5,5,'', clRed);
    AddVector(5,5,5,5,0,5,'', clRed);
    AddVector(5,5,5,5,10,5,'', clRed);
    AddVector(5,5,5,5,5,0,'', clRed);
    AddVector(5,5,5,5,5,10,'', clRed);
  end;
end;
Project1_2019-02-18_10-09-28.png
Project1_2019-02-18_10-09-28.png (51.61 KiB) Viewed 49 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Image Please read our Bug Fixing Policy

axrDegen
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by axrDegen » Mon Feb 18, 2019 11:36 am

Hello Yeray,

that's a nice solution, interesting is that I can't get the Labels to work in call "AddVector", like:

AddVector(5,5,5,0,5,5,'Vector A', clRed);

Do you have a solution for that?
Also it would be nice to have real 3D Arrows on top of the Vector lines.

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

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by Yeray » Tue Feb 19, 2019 11:17 am

Hello,
axrDegen wrote:
Mon Feb 18, 2019 11:36 am
interesting is that I can't get the Labels to work in call "AddVector", like:

AddVector(5,5,5,0,5,5,'Vector A', clRed);

Do you have a solution for that?
Try turning the Marks visible:

Code: Select all

    Marks.Visible:=True;
    Marks.Style:=smsLabel;
axrDegen wrote:
Mon Feb 18, 2019 11:36 am
Also it would be nice to have real 3D Arrows on top of the Vector lines.
How would you like them to look exactly?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Image Please read our Bug Fixing Policy

axrDegen
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by axrDegen » Tue Feb 19, 2019 12:39 pm

Ok, that makes them appear, but all the Labels are displayed together at the center point, please see the screenshot:
LabelsCapture.PNG
LabelsCapture.PNG (74.15 KiB) Viewed 25 times
How Can I display the labels at the end of the Arrows?
The Arrowheads I would expect to be shown as a (3D) Cone, see below:
3DArrowdownload.jpg
3DArrowdownload.jpg (6.63 KiB) Viewed 25 times

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

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by Yeray » Wed Feb 20, 2019 11:18 am

Hello,

I'm afraid this is not possible right now.
I've created a new ticket in the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=2161
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Image Please read our Bug Fixing Policy

axrDegen
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am

Re: How can I draw nice 3D Arrows to depict axes (a,b,c)

Post by axrDegen » Wed Feb 20, 2019 12:42 pm

Ok, that is about making it nice, but what about the markers/labels, how can I get these displayed correctly?

Post Reply