Draw 3D curves and shapes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Draw 3D curves and shapes

Post by liuxs » Tue Dec 26, 2017 7:04 am

1. Is it effective to use some Point3DSeries, ShapeSeries and SurfaceSeries on one Chart concurrently? In addition, is the Point3DSeries generally used to draw 3D curves?
2. It seems that the TopAxis does not appear on the Point3DSeries Chart. If the three TChartAxes are required as shown in Fig3D, How to implement? Would you like to give me an example?
3. The titles of some TChartAxes are always horizontal or vertical, is it possible to slant them to the direction of the ChartAxes?
4. I have located a reference to a MakeIso3DAxis procedure in the forums, but it made in VB6. Do you have a link to the code in Delphi?
Attachments
Fig3D.jpg
Fig3D.jpg (68.91 KiB) Viewed 10958 times

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

Re: Draw 3D curves and shapes

Post by Yeray » Mon Jan 08, 2018 11:27 am

Hello,
liuxs wrote:1. Is it effective to use some Point3DSeries, ShapeSeries and SurfaceSeries on one Chart concurrently? In addition, is the Point3DSeries generally used to draw 3D curves?
Using OpenGL gives a better result in 3D charts with crossing lanes or planes.
Also note the Shape Series is a 2D series and it's drawn in a Z position internally calculated based on it's position in the SeriesList.
liuxs wrote:2. It seems that the TopAxis does not appear on the Point3DSeries Chart. If the three TChartAxes are required as shown in Fig3D, How to implement? Would you like to give me an example?
Here it is:

Code: Select all

uses TeeShape, TeePoin3, TeeSurfa, TeeGLCanvas;

var ShapeSeries: TChartShape;
    SurfaceSeries: TSurfaceSeries;
    PointSeries: TPoint3DSeries;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.Canvas:=TGLCanvas.Create;

  Chart1.Aspect.Orthogonal:=False;
  Chart1.Aspect.Zoom:=65;
  Chart1.Chart3DPercent:=100;
  Chart1.Legend.Visible:=False;

  ShapeSeries:=Chart1.AddSeries(TChartShape) as TChartShape;
  SurfaceSeries:=Chart1.AddSeries(TSurfaceSeries) as TSurfaceSeries;
  PointSeries:=Chart1.AddSeries(TPoint3DSeries) as TPoint3DSeries;

  SurfaceSeries.FillSampleValues;

  for i:=0 to SurfaceSeries.Count-1 do
    PointSeries.AddXYZ(SurfaceSeries.XValue[i], SurfaceSeries.YValue[i], SurfaceSeries.ZValue[i]);

  with ShapeSeries do
  begin
    X0:=SurfaceSeries.XValues.MinValue;
    Y0:=SurfaceSeries.YValues.MinValue;
    X1:=SurfaceSeries.XValues.MaxValue;
    Y1:=SurfaceSeries.YValues.MaxValue;
  end;

  ShapeSeries.HorizAxis:=aTopAxis;
  SurfaceSeries.HorizAxis:=aTopAxis;
  PointSeries.HorizAxis:=aTopAxis;
  Chart1.Axes.Left.ZPosition:=100;
  Chart1.Axes.DepthTop.Visible:=True;

  Chart1.Walls.Visible:=False;
end;
liuxs wrote:3. The titles of some TChartAxes are always horizontal or vertical, is it possible to slant them to the direction of the ChartAxes?
You could try to calculate the angle at the Chart's OnBeforeDrawAxes event and set the Axis Title.Angle property.
liuxs wrote:4. I have located a reference to a MakeIso3DAxis procedure in the forums, but it made in VB6. Do you have a link to the code in Delphi?
There's an example without code here. I'll try to find and attach the code here if possible.
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

liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

Re: Draw 3D curves and shapes

Post by liuxs » Tue Jan 09, 2018 6:52 am

There's an example without code here. I'll try to find and attach the code here if possible.
I cannot download the file from the link you provided. Can you attach it here or email it to me? Thanks!

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

Re: Draw 3D curves and shapes

Post by Yeray » Wed Jan 10, 2018 10:06 am

Hello,

Find it here.
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