Page 1 of 1

Draw 3D curves and shapes

Posted: Tue Dec 26, 2017 7:04 am
by 16582574
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?

Re: Draw 3D curves and shapes

Posted: Mon Jan 08, 2018 11:27 am
by yeray
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.

Re: Draw 3D curves and shapes

Posted: Tue Jan 09, 2018 6:52 am
by 16582574
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!

Re: Draw 3D curves and shapes

Posted: Wed Jan 10, 2018 10:06 am
by yeray
Hello,

Find it here.