1

Environment RAD Studio 10.1 Berlin using Delphi TeeChart Pro v2017.22 170619 IntraWeb 14.1.14

I am creating a Web Page using IntraWeb to display various images. One of these, recently requested, is a 3D pipe/tube image with a surface color contour/gradient that I control as shown in the following concept image:

Pipe Concept Image.

I need to be able to rotate, pan and zoom this image. I am hoping there is a way to implement this using TeeChart.

As far as I am able to determine TChart only supports surface meshes and not a 3D surface on an object.

I would like to use TeeChart but am open to other possibilities. I have looked for other components that may support this but have not been able to find any.

I have looked at possible using FMX but IntraWeb is a VCL application. I know that FMX has been used in VCL so this is a possibility. However if this is possible I am not sure if it is possible to create the pipe with a color surface contour/gradient.

Yeray
  • 5,009
  • 1
  • 13
  • 25
Bob
  • 53
  • 3

1 Answers1

0

About the interactivity, if you want to rotate the series (not the image) I'm not sure if you can forward the events from Intraweb to the Chart to rotate it.

  • An option would be to use the TVoluemPipeSeries. Ie:

    uses TeeGLCanvas, TeeVolumePipe;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Chart1.Canvas:=TGLCanvas.Create;
    
      Chart1.Legend.Visible:=False;
      Chart1.Chart3DPercent:=100;
      Chart1.Aspect.Orthogonal:=False;
      Chart1.Aspect.Rotation:=230;
    
      with Chart1.AddSeries(TVolumePipeSeries) as TVolumePipeSeries do
      begin
        FillSampleValues;
        Pen.Color:=Chart1.Canvas.ColorFrom(Pen.Color,150);
      end;
    end;
    

VolumePipe

  • Another option is to use two TSurfaceSeries. Ie:

    uses TeeSurfa, Math;
    
    var topSurface, bottomSurface: TSurfaceSeries;
    
    procedure TForm1.FormCreate(Sender: TObject);
    var nRev, countZ, i, z: Integer;
        alpha, x, y: Double;
    begin
      Chart1.Legend.Visible:=False;
      Chart1.Chart3DPercent:=100;
      Chart1.Aspect.Orthogonal:=False;
      Chart1.Aspect.Zoom:=80;
      Chart1.Aspect.Rotation:=320;
      Chart1.Aspect.Elevation:=350;
      Chart1.Walls.Visible:=False;
      Chart1.Axes.Visible:=False;
    
      nRev:=50;
      countZ:=20;
    
      bottomSurface:=Chart1.AddSeries(TSurfaceSeries) as TSurfaceSeries;
      topSurface:=Chart1.AddSeries(TSurfaceSeries) as TSurfaceSeries;
    
      topSurface.IrregularGrid:=True;
      topSurface.XValues.Order:=loNone;
      topSurface.YValues.Order:=loNone;
      topSurface.Pen.Color:=Chart1.Canvas.ColorFrom(bottomSurface.Pen.Color,150);
    
      bottomSurface.IrregularGrid:=True;
      bottomSurface.XValues.Order:=loNone;
      bottomSurface.YValues.Order:=loNone;
      bottomSurface.Pen.Color:=Chart1.Canvas.ColorFrom(bottomSurface.Pen.Color,150);
    
      for z:=0 to countZ-1 do
      begin
        for i:=0 to nRev-1 do
        begin
          alpha:=DegToRad(i*360/nRev);
          x:=Cos(alpha);
          y:=Sin(alpha);
    
          if alpha<DegToRad(180) then
            topSurface.AddXYZ(x, y, z, '', RGB(random(255), random(255), random(255)))
          else
            bottomSurface.AddXYZ(x, y, z, '', RGB(random(255), random(255), random(255)));
        end;
    
        bottomSurface.AddXYZ(topSurface.XValues.MaxValue, Sin(ArcCos(topSurface.XValues.MaxValue)), z, '', RGB(random(255), random(255), random(255)));
        bottomSurface.AddXYZ(topSurface.XValues.MinValue, Sin(ArcCos(topSurface.XValues.MinValue)), z, '', RGB(random(255), random(255), random(255)));
      end;
    end;
    

Surfaces

Yeray
  • 5,009
  • 1
  • 13
  • 25
  • The TeeVolumePipe was quite slow in rendering compared to the two surfaces also I could not see a way to get the gradient colors. How do I get the two surfaces to show a smooth gradient between colors to get the contour effect I had in my original image? – Bob Sep 01 '17 at 22:24
  • The `TVoluemPipeSeries` example above is slow because of OpenGL initialization. When that has been done, it's fast. – Yeray Sep 04 '17 at 13:19
  • In the example I've set random colors to the `TSurfaceSeries` cells. You could set use your palette to set the colors as you want – Yeray Sep 04 '17 at 13:21